简体   繁体   中英

How to check which sections of a site are tracked by Google Analytics

I'm currently managing a PHP website that "integrates" several independent modules under the same domain. And by independent I mean that they don't share common templates, some small parts even being static HTML pages.

Where it's present, the Google Analytics code is included the proper way .

In such a scenario, how can one check which how much of the site does Google Analytics actually track, and even more important how do I find the pages/sections that are not tracked yet?


PS: Trying with cURL , this is the output I get:

$ curl my-site.com | grep -c google-analytics.com
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12982    0 12982    0     0  11844      0 --:--:--  0:00:01 --:--:-- 20221
0

To audit the tracking of your site you have a few tools (not exactly free however)

WASP

ObservePoint

The only valid method would be to crawl the whole site with a JavaScript enabled crawler and check that every page fires a hit.

You could also have some creative strategies (depending on what you can change or not on this site):

  • Add a second tracker over the whole site (for example as an external JS called everywhere, you can even use an existing resource and append the code for GA in it. After a few days of collection, you export hostnames and pages tracked by the 2 systems and you'll find what's not tracked and needs to be fixed
  • If you have some control over the existing code, you can combine an external JS at the bottom of the page, doing the default tracking on the same UA-XXXX-YY, but firing only when the inline code wasn't present above (you set var tracked = true inline, and test 'tracked' in the external JS before firing a pageview)

How does it sounds to you ?

I like using Screaming Frog to audit which pages have GA code vs which don't. This is only an option on the paid version, but they make it very easy to do a custom search, so I'll typically run two simultaneously while spidering the site - one asking for a report of which pages do have GA code and one asking for the pages that don't.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM