Skip to content

Commit

Permalink
Merge pull request #2 from stape-io/added-support-for-li_fat_id-cookie
Browse files Browse the repository at this point in the history
added support for li_fat_id cookie
  • Loading branch information
Bukashk0zzz authored Feb 26, 2024
2 parents 7978fcc + d2e6119 commit 6ce09d2
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
2 changes: 2 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
homepage: 'https://stape.io/'
versions:
- sha: ab0b14b682472f6a87d2ec1f50043efc84a00c60
changeNotes: Added support for li_fat_id cookie.
- sha: 03a1368289395fb6f51c26af0b76a47aa973e454
changeNotes: Initial release.
8 changes: 7 additions & 1 deletion template.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const getTimestampMillis = require('getTimestampMillis');
const Math = require('Math');
const makeNumber = require('makeNumber');
const makeTableMap = require('makeTableMap');
const getCookieValues = require('getCookieValues');
const decodeUriComponent = require('decodeUriComponent');

const isLoggingEnabled = determinateIsLoggingEnabled();
const traceId = isLoggingEnabled ? getRequestHeader('trace-id') : undefined;
Expand Down Expand Up @@ -199,8 +201,12 @@ function getUserEmail() {
}

function getLinkedInFirstPartyAdsTrackingUuid() {
const liFatId = decodeUriComponent(getCookieValues('li_fat_id')[0] || '');
return (
userIdsOverride.linkedinFirstPartyId || user_data.linkedinFirstPartyId || ''
liFatId ||
userIdsOverride.linkedinFirstPartyId ||
user_data.linkedinFirstPartyId ||
''
);
}

Expand Down
50 changes: 47 additions & 3 deletions template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,13 @@ ___TEMPLATE_PARAMETERS___
{
"displayName": "User Ids Override",
"name": "userIdsGroup",
"groupStyle": "ZIPPY_CLOSED",
"type": "GROUP",
"subParams": [
{
"type": "LABEL",
"name": "userIdsLabel",
"displayName": "Tag will attempt to parse cookie/event data but you can provide those parameter explicitly, at least one identifier is needed for a successful request."
},
{
"name": "userIds",
"simpleTableColumns": [
Expand Down Expand Up @@ -179,7 +183,8 @@ ___TEMPLATE_PARAMETERS___
"type": "SIMPLE_TABLE",
"newRowButtonText": "Add property"
}
]
],
"groupStyle": "ZIPPY_CLOSED"
},
{
"displayName": "User Info Override",
Expand Down Expand Up @@ -283,6 +288,8 @@ const getTimestampMillis = require('getTimestampMillis');
const Math = require('Math');
const makeNumber = require('makeNumber');
const makeTableMap = require('makeTableMap');
const getCookieValues = require('getCookieValues');
const decodeUriComponent = require('decodeUriComponent');

const isLoggingEnabled = determinateIsLoggingEnabled();
const traceId = isLoggingEnabled ? getRequestHeader('trace-id') : undefined;
Expand Down Expand Up @@ -470,8 +477,12 @@ function getUserEmail() {
}

function getLinkedInFirstPartyAdsTrackingUuid() {
const liFatId = decodeUriComponent(getCookieValues('li_fat_id')[0] || '');
return (
userIdsOverride.linkedinFirstPartyId || user_data.linkedinFirstPartyId || ''
liFatId ||
userIdsOverride.linkedinFirstPartyId ||
user_data.linkedinFirstPartyId ||
''
);
}

Expand Down Expand Up @@ -789,6 +800,39 @@ ___SERVER_PERMISSIONS___
"isEditedByUser": true
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "get_cookies",
"versionId": "1"
},
"param": [
{
"key": "cookieAccess",
"value": {
"type": 1,
"string": "specific"
}
},
{
"key": "cookieNames",
"value": {
"type": 2,
"listItem": [
{
"type": 1,
"string": "li_fat_id"
}
]
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
}
]

Expand Down

0 comments on commit 6ce09d2

Please sign in to comment.