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

JillsMatthew

Avatar

JillsMatthew

JillsMatthew

24-09-2017

Go to Global Variables section in DTM, and open the custom script section. Add the code s.abort(). This will disable any default/global tracking. Once you do this, you should be able to create seperate rules for each pages based on your path conditions.