Highlighted

DTM Page Load rule firing twice

Avatar

Avatar

jayak13010535

Avatar

jayak13010535

jayak13010535

09-06-2017

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.

Replies

Highlighted

Avatar

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

308

Correct Answer

570

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

308

Correct Answer

570
jantzen_belliston-Adobe
Community Manager

09-06-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

Highlighted

Avatar

Avatar

jayak13010535

Avatar

jayak13010535

jayak13010535

09-06-2017

Hi Jantzen,

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

Highlighted

Avatar

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

308

Correct Answer

570

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

308

Correct Answer

570
jantzen_belliston-Adobe
Community Manager

09-06-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.

Highlighted

Avatar

Avatar

jayak13010535

Avatar

jayak13010535

jayak13010535

10-06-2017

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.

1226773_pastedImage_1.png

Please advise.

Highlighted

Avatar

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

308

Correct Answer

570

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

308

Correct Answer

570
jantzen_belliston-Adobe
Community Manager

12-06-2017

You said " takes time to include pageBottom function" are you dynamically injecting the DTM Embed code into the page?

Also, do you have a URL where this is taking place? You shouldn't be getting two Analytics tracked a page view messages in the console. That message typically shows when the page load beacon has fired. If it's firing twice, I'd guess there is something going on with the implementation.

Highlighted

Avatar

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

308

Correct Answer

570

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

308

Correct Answer

570
jantzen_belliston-Adobe
Community Manager

12-06-2017

Thanks for sending the URL via private message. If possible, including it here publicly allows others to also try and troubleshoot.

I was able to look at the page and viewing the source code I wasn't able to find your DTM footer code "<script type="text/javascript">_satellite.pageBottom();</script>". Is the footer code being dynamically injected in? If so, could this be changed to be included statically like the header embed code?

Highlighted

Avatar

Avatar

Kaushalendra

Employee

Avatar

Kaushalendra

Employee

Kaushalendra
Employee

18-06-2017

Hi jayak13010535​,

If the issue is still not resolved, I would suggest posting the URL along with the steps to replicate the issue so that we can try troubleshooting the issue at our end.

Highlighted

Avatar

Avatar

makbeta

Avatar

makbeta

makbeta

11-06-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. 😞

Highlighted

Avatar

Avatar

sunilrongali

Avatar

sunilrongali

sunilrongali

23-07-2018

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