From d229fb02e6ceb048f41f3f13ee52643d4a15206e Mon Sep 17 00:00:00 2001 From: Platoscaves Date: Wed, 17 May 2023 19:33:59 +1000 Subject: [PATCH] Add ttp param in the USER_DATA Get the ttp value from the payload, otherwise try to get it from the cookies (_ttp) and append it in the user object. --- src/track.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/track.ts b/src/track.ts index 3c86f92..043ba00 100644 --- a/src/track.ts +++ b/src/track.ts @@ -3,7 +3,8 @@ import { ComponentSettings, MCEvent } from '@managed-components/types' const USER_DATA: Record = { email: { hashed: true }, phone_number: { hashed: true }, - external_id: { hashed: true } + external_id: { hashed: true }, + ttp: { hashed: false } } const getTtclid = (event: MCEvent) => { @@ -79,6 +80,11 @@ export const getRequestBody = async ( delete payload[key] } } + + const ttpFromCookie = event.client.get('_ttp') + if (!body.context.user.ttp && ttpFromCookie) { + body.context.user.ttp = ttpFromCookie + } if (ttclid) { body.context.ad = {