So I have a page load rule that fires for our career operations page and populates evar43 and event43.. I also put an event rule on a CTA button on the career operations page, the button is called "job openings" The event rule fires if the button is clicked and populates event44. However the problem is, that when the job opening button is clicked not only is the job listing page opened in new tab, but it also refreshes/reloads the career operations page cause the page load rule to fire again. Obviously this inflates the true count for Career operations page. So I need a custom script to add to the page load rule that basically says do not fire if already on the career operations page. Any suggestions because I have not idea how I should do this. Oh by the way I am using DTM.
Thank you
Darius Dempsey
Solved! Go to Solution.
Views
Replies
Total Likes
ParitMittal wrote...
Hi Darius ,
Please add the following code in Custom Code section of Adobe Analytics tab of your Page Load rule for "Career Operations Page". This code will suppress the beacon from firing if the career operations Page is refreshed or Reloaded.
if(window.performance)
{
if(performance.navigation.type == 1 )
{
alert("Reload");
s.abort = true;
}
};
Thanks & Regards
Parit Mittal
Hi Darius,
To add to Parit Answer.
Check this first: http://stackoverflow.com/questions/5004978/check-if-page-gets-reloaded-or-refreshed-in-javascript
So when the page is loaded for the first time the following:
window.performance.navigation
Return this:
PerformanceNavigation { type: 0, redirectCount: 0 }
Now if you reload the page you should see the following:
PerformanceNavigation { type: 1, redirectCount: 0 }
So Parit code is correct to check if page was reloaded but not to prevent the page load rule to fire. You need to put:
return false;
So the final code should look as follow:
var loadRule = true; if(window.performance) { //Reload of page if(performance.navigation.type == 1 ){ loadRule = false; } } return loadRule;
I would also advis you to put this custom code in a Data Element to reuse it in all of your rules: example data element : loadRule
//Place in condition of any rule return _satellite.getVar("loadRule");
Best regards.
Alexis Cazes.
Lead Technical Support Engineer
Views
Replies
Total Likes
Hi Darius , Please add the following code in Custom Code section of Adobe Analytics tab of your Page Load rule for "Career Operations Page". This code will suppress the beacon from firing if the career operations Page is refreshed or Reloaded.
if(window.performance) { if(performance.navigation.type == 1 ) { alert("Reload"); s.abort = true; } };
Thanks & Regards
Parit Mittal
Views
Replies
Total Likes
ParitMittal wrote...
Hi Darius ,
Please add the following code in Custom Code section of Adobe Analytics tab of your Page Load rule for "Career Operations Page". This code will suppress the beacon from firing if the career operations Page is refreshed or Reloaded.
if(window.performance)
{
if(performance.navigation.type == 1 )
{
alert("Reload");
s.abort = true;
}
};
Thanks & Regards
Parit Mittal
Hi Darius,
To add to Parit Answer.
Check this first: http://stackoverflow.com/questions/5004978/check-if-page-gets-reloaded-or-refreshed-in-javascript
So when the page is loaded for the first time the following:
window.performance.navigation
Return this:
PerformanceNavigation { type: 0, redirectCount: 0 }
Now if you reload the page you should see the following:
PerformanceNavigation { type: 1, redirectCount: 0 }
So Parit code is correct to check if page was reloaded but not to prevent the page load rule to fire. You need to put:
return false;
So the final code should look as follow:
var loadRule = true; if(window.performance) { //Reload of page if(performance.navigation.type == 1 ){ loadRule = false; } } return loadRule;
I would also advis you to put this custom code in a Data Element to reuse it in all of your rules: example data element : loadRule
//Place in condition of any rule return _satellite.getVar("loadRule");
Best regards.
Alexis Cazes.
Lead Technical Support Engineer
Views
Replies
Total Likes
Views
Likes
Replies