From a8fbe50a81fd1acc5245458513d2e9ed96d0b49e Mon Sep 17 00:00:00 2001 From: Vriken Date: Wed, 11 Dec 2024 16:37:23 +0100 Subject: [PATCH] not removing other functions :) --- template.tpl | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/template.tpl b/template.tpl index 4e0090a..b5eab7a 100644 --- a/template.tpl +++ b/template.tpl @@ -41,7 +41,7 @@ ___TEMPLATE_PARAMETERS___ "name": "httpOnlyCookie", "checkboxText": "Write the _dcid cookie as HttpOnly", "simpleValueType": true, - "help": "If enabled, the _dcid cookie will be written with the HttpOnly flag, making it non-accsessible by javascript." + "help": "If enabled, the _dcid cookie will be written with the HttpOnly flag, making it non-accsessible by javascript.", "defaultValue": false }, { @@ -646,16 +646,20 @@ function addRequiredParametersToEventModel(eventModel) { return eventModel; } -function storeClientId(eventModel) { - if (data.generateClientId) { - setCookie('_dcid', eventModel.client_id, { - domain: 'auto', - path: '/', - samesite: getCookieType(eventModel), - secure: true, - 'max-age': 63072000, // 2 years - httpOnly: data.httpOnlyCookie, - }); +function exposeFPIDCookie(eventModel) { + if (data.exposeFPIDCookie) { + let fpid = getCookieValues('FPID'); + + if (fpid.length) { + setCookie('FPIDP', fpid[0], { + domain: 'auto', + path: '/', + samesite: getCookieType(eventModel), + secure: true, + 'max-age': 63072000, // 2 years + httpOnly: false, + }); + } } } @@ -667,7 +671,7 @@ function storeClientId(eventModel) { samesite: getCookieType(eventModel), secure: true, 'max-age': 63072000, // 2 years - httpOnly: false, + httpOnly: data.httpOnlyCookie, }); } }