Expand my Community achievements bar.

Join us at Adobe Summit 2024 for the Coffee Break Q&A Live series, a unique opportunity to network with and learn from expert users, the Adobe product team, and Adobe partners in a small group, 30 minute AMA conversations.
SOLVED

Page Load multiple times

Avatar

Level 3

Hello,

 

I have set up Adobe Analytics on the site, but when I go backwards on the site, I get multiple page loads happening. (like twice or thrice apart from the main event + page load , which I believe should happen only once).

 

Can someone guide me on how to fix this?

 

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

First you would need to check which rules are fired on your site (if you have implemented Adobe Launch or any other TMS).

 

When you say backwards do you mean using the back button in your browser? If that is the case depending on how you site is implemented it might behave in a specific way that loads different states on your site when you click on back button.

 

For example in some SPA when you click on back button it will unload current route, then load another route inbetween the previous route and and the current route to do some things. If you implementation looks at hash change or url change then it would trigger analytics calls for the route used in between

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

First you would need to check which rules are fired on your site (if you have implemented Adobe Launch or any other TMS).

 

When you say backwards do you mean using the back button in your browser? If that is the case depending on how you site is implemented it might behave in a specific way that loads different states on your site when you click on back button.

 

For example in some SPA when you click on back button it will unload current route, then load another route inbetween the previous route and and the current route to do some things. If you implementation looks at hash change or url change then it would trigger analytics calls for the route used in between

Avatar

Level 3

Thank you for the response.

 

I am using Adobe launch to set the rules.

 

Yes by back button I mean the one one the browser. 

 

Also the site I'm working is SPA.

 

 

Avatar

Community Advisor

SPAs by there very nature when back or forward buttons are pressed will do this double fire you see. Its caused by how SPA in essence reloads all of its components from root index and then the page state you were going to.

 

Ideally you have a direct call rule for the page state change via a satellite trackcall, your developer needs to adjust APP page code to not reload the analytics code twice on browser clicks back and forth. (relates to how many SPAs have an index.html that then also fires a second page load for desired next page state)

 

GLTU

Avatar

Level 3

Yes, got this done.

 

We are now calling the page load rule from the site code itself.

 

So now we are able to see one page load as we expected.

 

Thank you.

Avatar

Community Advisor

Right if you are using an SPA, could you provide example of how your URL structure is when you move from one "page" to another. Does the content only gets repainted or the route (URL) fet updated as well.

 

Also please provide example of you rule, what is the event, what are the conditions.

 

Depending on your SPA implementation they are multiple options for implementation. 

 

For example in our SPA the URL get updated between each "page", the hash gets changed. Prior using data layer with an events array, we used a solution to store current hash and if the hash did not change we aborted analytics call for example. 

Avatar

Level 3

Thank you for your response!

 

All our rules including page load rule are using direct call event.

 

Apart from that the main events have clear variables and set variables as action and page load has set variables , send beacon and clear variables.

 

I got my issue solved after adding clear variables on the page load rule and calling page load once from the site code.

 

Thanks.