setVar/data element/3rd party HTML issue

mikethompson

26-05-2016

Recently there was a change to DTM that made it so values passed in 3rd party Non-Sequential HTML tags via the %data element name% method no longer work if the data element isn't explicitly defined in the data element rules.  This means you can no longer simply use setVar in a rule somewhere to define a value and read it in this way.

This is having profound effects on how we typical handle marketing pixels.  Traditionally, we use either page load rules or direct call rules to define the "configuration" variables for marketing pixels, then make a call to that pixel (usually via a direct call rule).

For example, let's say we have a single page application that has, for example, 50 different "pages" that can be seen by the user. A _satellite.track call is made for each of these "pages" that has an s.t() call to ensure analytics tracking.  These 50 pages may also have a multitude of marketing pixels, some of which can have 1-8 configuration variables.

Previously, that main direct call rule that handles tracking would check each "page" to see if it has pixels and, if so, set the config variables with _satellite.setVar, then call the marketing tag. This no longer works as the 3rd party HTML will no longer read these values because they aren't defined in the "data element" area.

I've gotten around the issue temporarily by creating an actual data element for these config variables and reading in the value of the _satellite.data.customVars for that particular value, something like this:

Data element name = varname, type=custom script

if (_satellite.data.customVars.varname) {return _satellite.data.customVars.varname};

However, I've been told use of _satellite.data.customVars is not supported and should not be used.

So my question is, how are others handling this type of issue?  _satellite.getVar cannot be used in a 3rd party HTML and we've had some issues in the past trying to use 3rd party javascript for some tags.

Accepted Solutions (1)

Accepted Solutions (1)

Answers (3)

Answers (3)

laura_vl

22-09-2016

I am also running into this issue when setting a third-party tag within an event-based rule. Since it's event-based, I cannot select Sequential HTML and since the tag uses "document.write", I cannot use the JavaScript tag options, so I was wondering if there was another workaround to this problem?

mikethompson

02-06-2016

The %data element name% does still work in Non-Sequential HTML (both %data element name% and _satellite.getVar seem to work in Sequential HTML), but only if 'data element name' is defined in the data elements rules. Until a month ago, you could also just use a setVar to create the value even if 'data element name' wasn't explicitly defined and it would work, but no longer (thus my original post). Using %data element name% has always worked since we started using DTM over two years ago. 

I ended up creating separate variables at the page level to hold all my configuration values, setting those values in my rules where I had previously used setVar, then pointing new data elements to these variables which seems to have gotten around the problem (though did require rewriting 150 rules).

We prefer to use the non-sequential options just to help prevent something from blocking the page (for example, a 3rd party pixel is slow to load or the tag was misconfigured).

ParitMittal

02-06-2016

Hi Mike , 

 %data element name%  only works inside UI it doesn't work inside any Custom Javascript and it never used to be. I wonder how come you were able to use it.  Also,  when you configure your tag to be Non-Sequential HTML, the code output is dynamically in an iframe. Since the iframe doesn't include the _satellite object, attempting to reference it results in an undefined error.

If your tag contains a blend of html and javascript that needs to be output and you need _satellite exposed, you need to instead use a Sequential HTML tag.

Alternatively, if the code in your tag is really purely javascript and just happens to be wrapped in <script> tags, then simply remove the <script> tag wrapper and put the code in a Javacript style tag (It doesn't matter if it's sequential or non-sequential; both will have _satellite exposed to it.

Also, We are looking for some alternate to how to access a dataElement inside 3rd Party Non Sequential HTML  section and we will get back to you on the same.

Thanks & Regards

Parit Mittal