How to delete Cookie data from datalayer?

Rookie Contributor


is there a simple way to prevent Tealium from collecting First Party Cookie Data (e.g. Google Analytics or own Cookies) and sending it to e.g. EventStore?




How to delete Cookie data from datalayer?

Tealium Expert
Tealium Expert

Hi @Aberger - it's probably best to set that value to nothing (as in "") instead of trying to delete. 

How to delete Cookie data from datalayer?

Tealium Expert
Tealium Expert

Most tags will only transmit the data that's explicitly mapped, so having cookie data in usually won't mean that it goes anywhere.

However, for any tags that do collect the entire data layer, a tag-scoped extension to blank out the values (as @mitchellt suggests) would be the best way. Create a JavaScript extension, scope it to the tags you need to remove cookie data from, and use the following code:

// For each UDO variable (k) within the event payload (b)
for(var k in b){
  // If the variable name starts "cp." then..
  if(typeof k === "string" && k.indexOf("cp.") === 0){
    // Set that variable to a blank string
    b[k] = "";

How to delete Cookie data from datalayer?

Tealium Employee

@Aberger Good suggestions above.

1. Rather than set to "", I would suggest 

delete b[''];

to delete a specific cookie, or delete 

delete b[k];

 if using @UnknownJ's approach

This removes any reference to the cookie data in the data payload sent to the collect tag.

2. It is possible to send the cookie data to the UDH (for example to use in AudienceStream), but not have it sent onwards to EventDB, EventStore or EventStream.

The relevant event attributes could be marked as restricted in UDH.  They won't then be sent to EventStore unless explicitly configured to be.  There is a separate checkbox to specify if the event attribute should go to EventDB, see screenshot.  As for EventStream, the UI will warn you if you choose a restricted attribute to send from an EventStream.

Tealium - Universal Data Hub 2018-06-26 21-21-21.png