Stop firing standard GA code on certain pages

Avatar

Avatar
Validate 1
Level 1
ed_mason
Level 1

Like

1 like

Total Posts

10 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
ed_mason
Level 1

Like

1 like

Total Posts

10 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
ed_mason
Level 1

15-10-2015

Hi,

By default Satellite fires our GA code to all pages that has the Satellite code on, is there any way to select pages we do not want the pageview to fire on? (so we can use a virtual pageview for instance).

Thanks,

Ed

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Employee
AllDayDev
Employee

Likes

33 likes

Total Posts

138 posts

Correct reply

73 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile

Avatar
Boost 5
Employee
AllDayDev
Employee

Likes

33 likes

Total Posts

138 posts

Correct reply

73 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile
AllDayDev
Employee

15-10-2015

I am not sure about "selecting" pages per se, but you can set conditions. What is the criteria you are using for pages where you don't want to trackPageview?

e.g. are all of the pages under a specific path, or have a certain parameter set, etc.
Or do you just have a list of pages that do not have anything specific to uniquely identify them as different from the other pages?

If you do have some unique criteria, you could add custom JavaScript to test for it to the "Customize Page Code" section of your GA "tool" in DTM (Satellite).

Assuming that you have pages under a specific path that you do not want to track, then here is some example code that assumes your path starts with /nogatracking/ (e.g. http://www.mysite.com/nogatracking/somepage.html):

(!(/^\/nogatracking\//i.test(window.location.pathname)))

This is doing a case-insensitive parsing of the current page's path. If the path starts with "/nogatracking/" then it returns false (which disables the _trackPageview); if not matching this path, then it returns true.

 

There may be other ways of accomplishing what you want, so let us know if this does not meet your needs or if you have any questions.

- Carey

Answers (0)