DTM Page Load rule firing twice | Community
Skip to main content
Level 3
June 9, 2017

DTM Page Load rule firing twice

  • June 9, 2017
  • 2 replies
  • 16230 views

Hi,

We have a page where we dynamically load the dtm footer code and whenever this page loads, all the page load rules (with condition as fires at the bottom of the page) get fired twice. I am not sure what's happening here. This is only happening with the page load rules which get fired at the bottom of the page and all the other rules get fired as expected.

Any pointers will be highly appreciated!

Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

jantzen_b
Adobe Employee
Adobe Employee
June 9, 2017

Hi,

When you say your rule is being fired twice, are you seeing a message in the console with DTM Debug mode turned on indicating the rule fired twice or are you just seeing two identical beacons?

Thanks,
Jantzen

Level 3
June 9, 2017

Hi Jantzen,

I am using DTM Switcher Debugger mode to see the number of rules getting fired on page load.

Level 3
June 10, 2017

Can you include a screenshot of what you're seeing? Also, a URL of where this is occurring would allow me to do a bit more troubleshooting.


Hi Jantzen,

You can refer the attached screen shot. After I changed the rules condition to 'DOM Ready', I am able to fire all the rules only once. But, now the major issue is DTM is sending two beacons on this page load. I can see that after all the page load rules gets fired, DTM calls sendBeacon function to send data to Analytics server. However, later when DTM footer code gets included on the page, this also fires another beacon.

I am not sure what exactly is happening here. I tried changing doPlugins function in DTM, but this doesn't make any difference since this whole Analytics Tool setup works perfectly fine on the other pages. This problem exists on only one page. May be because this page has lots of contents to be loaded and takes time to include pageBottom function and this pageBottom function internally makes a call to the sendBeacon function.

Please advise.

makbeta
Level 2
June 11, 2018

I've ran into the same issue before and here's what I was able to find.

My setup

<head><script src="satellite-code.js</head>

<body>

<script src="scripts-that-sets-digitalData-object-and-fire-an-event-when-ready.js" ></script>

<script type="text/javascript">

     jQuery(document).on('analytics-ready', (function() {

       _satellite.pageBottom();

    });

</script>

What I found is that this setup will always cause the DTM rules to fire twice. Because the logic in DTM code runs as follows:

Fire the rules if you see pageBottom on document load. If the rule wasn't run when the document is ready, DTM will fire the rule on DOM ready.  So it will fire once on DOM ready because pageBottom wasn't yet executed and the second time when my pageBottom function is called after DOM ready.

So pageBottom rule is really pageBottom or DOM ready, whichever comes first.

There is no real good way to tell DTM when the digitalData is ready and fire off the default rule then. :-(

July 24, 2018

Is there a solution for this to stop domready event..?

makbeta
Level 2
July 24, 2018

sunilrongali,

There is no way to stop the DOM ready event. The approach is to to disable the standard page load rule and use direct call rule to  track page views.