Expand my Community achievements bar.

SOLVED

Issues with Non-Sequential HTML script in Event Based Rule

Avatar

Level 2

I am experiencing issues using a non-sequential HTML script within an event based rule in DTM. The script loads a 3rd party analytics package, which sets an Adobe Analytics Page Name and all of the analytics variables (props, evars, etc). I have confirmed that the script is being injected properly into the code, however there is a bug related to the population of page name.

Current Implementation

I have (1) a page load rule (accounts for loading the html script on initial page load) and (2) an event based rule (accounts for loading the html script when changing pages without a full page load). The page load rule injects the script using a sequential HTML tag and is functioning correctly. The event based rule, which holds the same script in a non-sequential HTML tag, is causing issues. Note: we cannot use DTM's Adobe Analytics Tool as a fix due to restrictions from the third party.

Expected Behavior: Adobe Analytics Page Name should load as [Page URI]:[Page Path]. See screenshot A below.

Actual Behavior: Adobe Analytics Page Name is loading as 'assets.adobedtm.com:/588435b0fcfa3a89fe235f18afab7c097c8bbcdf/scripts/satellite-59cd455b64746d5205011eeb-staging.html'. See screenshot B below.

Questions:

1. Why is Adobe recognizing Page URI as 'assets.adobedtm.com' and page path as <the HTML file's path> when the Event Based Rule fires?

2. Are there any known issues related to using a non-sequential HTML tag within an event based rule?

3. Are there any workarounds for firing an HTML script using an event based rule?

Screenshot A. Page Load Rule (page name correct):

Page Name.png

Screenshot B. Event Based Rule (page name incorrect):

Page Name Bug.png

1 Accepted Solution

Avatar

Correct answer by
Level 10

You'd likely need to change the HTML to JavaScript. There is no such thing as non-sequential HTML really. In order to accomplish a non-sequential impact to the site, the HTML is loaded inside an iframe. Typically, vendors have an HTML and JavaScript version of their tags. The HTML is usually provided because it's similar for marketers to deploy to a typical site. In fact, most HTML marketing tags are actually calling javascript. You'd see this in the HTML when there is a <script> and </script> tag within the code they give you.

I'd reach out to your vendor to see if they can provide a pure javascript version of the tag. Once you have that, you can place that in the non-sequential JavaScript section and I'd guess it would work without issue.

View solution in original post

6 Replies

Avatar

Level 10

How are you setting the Page Name variable in these two rules? Are you using a data element? If so, is it the same data element and how is it set?

Avatar

Level 2

Page Name is getting set within the custom script. No values are being set within DTM interface. Only thing DTM is handling is injecting the script on the page and both rules are using the same script.

Avatar

Level 10

After a bit of research, it looks like non-sequential HTML is placed into iframes on event based rules. Since the script is loaded inside an iframe, It doesn't have access to the page and thus it is pulling the pagename of the iframe rather than the page itself.

Load Order for Rules

Avatar

Level 6

Hi margaretc50536749

Based on what I've seen in your description, my theory is that Event Based Rules, which uses Adobe's s.tl() function doesn't support the capturing of the pageName variable like Page Load Rules do.  You might have to set a separate variable in your Page Load Rule and then have the Event Based Rule pull that separate variable. 

Hope that helps generate some additional ideas on how to resolve your issue.

Avatar

Level 2

Thanks for your reply Jantzen.Belliston; that makes sense.

Are there any other ways to implement this HTML code based on an event (data element changed) where it would not be placed in an iframe? As mentioned, it's necessary that we inject the code based on an event rather than page load due to the single page app functionality of the site.

Avatar

Correct answer by
Level 10

You'd likely need to change the HTML to JavaScript. There is no such thing as non-sequential HTML really. In order to accomplish a non-sequential impact to the site, the HTML is loaded inside an iframe. Typically, vendors have an HTML and JavaScript version of their tags. The HTML is usually provided because it's similar for marketers to deploy to a typical site. In fact, most HTML marketing tags are actually calling javascript. You'd see this in the HTML when there is a <script> and </script> tag within the code they give you.

I'd reach out to your vendor to see if they can provide a pure javascript version of the tag. Once you have that, you can place that in the non-sequential JavaScript section and I'd guess it would work without issue.