stape-io / twitter-tag

Twitter tag for Google Tag Manager Server Side
https://stape.io/blog/twitter-conversion-api-tag-for-sgtm
Apache License 2.0
1 stars 0 forks source link

Change the cookie name from twclid to _twclid? #7

Closed giovaniortolani closed 7 months ago

giovaniortolani commented 7 months ago

https://github.com/stape-io/twitter-tag/blob/2084570a5cfce7bd6b25871ed3ced38ef3f9ed10/template.js#L89

The cookie name probably should be _twclid because the https://static.ads-twitter.com/uwt.js Twitter Client code uses _twclid. Look for TWCLID_COOKIE_NAME inside the code.

What do you think?

Also, the Client code uses an object (it runs JSON.stringify and encodeURIComponent before saving it as cookies) as the cookie value in the format

{ "pixelVersion":"2.3.29", "timestamp":"1710342385716", "twclid":"123123123", "source":1 }

To me, only the twclid inside the object is important here.

Perhaps should the sGTM version also set the cookie as the Client code does?

mrsnippy commented 7 months ago

Hello Giovani,

Thanks for reaching out.

There is no objective in place for CAPI tag to be replicating the Twitter Pixel functionality, they are two different things and there's even an official statement that CAPI can be used w/o the Pixel. So to address your particular points:

  1. Cookie names is different intentionally not to interfere with the one set by the Pixel

  2. CAPI only expects the click_id (twclid) as part of the payload, and not the other stuff that web pixel puts into a cookie so it would be redundant to set that information, give that we have a separate cookie as my previous point suggests.

giovaniortolani commented 7 months ago

@mrsnippy, great. Thank you so much for your comprehensive reply :)