DTM - Fire Third-Party Pixel Only Once Per Visitor?



I have one DoubleClick tag on several different pages set via DTM. Is it possible to have the tag fire only once per visitor, regardless of how many times a visitor views a page with the DoubleClick tag on it?

Thanks in advance!


Accepted Solutions (1)

Accepted Solutions (1)




First, create a new Data Element.  

Name: isExistingVisitor

Type: Custom Script

Default Value: false

Remember this value for: Visitor

Then open the code editor for the Custom Script and put the following:

var dtm_ev = _satellite.readCookie('dtm_ev'); _satellite.setCookie('dtm_ev','true',1000); dtm_ev=dtm_ev?'true':'false'; return dtm_ev;

Now save the Data Element.

Then, go to your Page Load Rule where you have your DoubleClick tag. 

Go to Conditions, and for Criteria, select Data > Data Element Value, and click the Add Criteria button.

Then in the Data Element dropdown that appears, choose "isExistingVisitor", and for the Value, put "false" (no quotes).

Save the rule and Approve/Publish the Data Element and Page Load Rule.

What this does is create a data element that first reads a cookie, then returns true or false depending on the cookie. If the cookie is not found, we return false, to signify that this is not an existing visitor. Otherwise we return true, to signify that it is an existing visitor.  The cookie is set to expire 1000 days into the future and gets bumped up every time the page is loaded.  The Data Element is also set to remember the returned value for "Visitor" life-cycle. This is probably overkill, but meh, why not. 

Then, the Page load rule is now set to trigger only if the data element returns false.  So, as long as a visitor does not delete the cookie, it should only trigger the page load rule once.  Or.. if the visitor leaves and comes back after 1000 days, the cookie will have expired and the page load rule will trigger.