Fire analytics only on certain pages...

Avatar

Avatar

davidp86482746

Avatar

davidp86482746

davidp86482746

22-09-2017

Is it possible to have Analytics fire only on certain pages? I tried adding a path condition in DTM to the page load rule, but that didn't seem to make any difference at all. I'm now trying to accomplish the same result by deactivating the beacon via the following custom code:

if(document.location.href.indexOf("whatever")!=-1){

    return false

}

Does anyone have any tips on what the actual best way to have Analytics only fire on certain pages?

View Entire Topic

Avatar

Avatar

appuriabhi

Avatar

appuriabhi

appuriabhi

23-01-2018

Hi - davidp86482746

Yes, you can navigate to tools ->Adobe Analytics - > Custom Code and set following condition -

if (window.location.pathname.indexOf("path1") != -1 || window.location.pathname.indexOf("path2") != -1)
{
//set custom pageCode here
}
else
{
return false;
}

This way the page view image request will only be processed for paths added in your condition above.