Site logo

Archived topic

Google Analytics Code Not Working After Switching to GP

7 replies · Started by Alyson on July 23, 2022

Viewing posts 1–8 of 8

Hi, I've switched 2 existing sites to GP day before yesterday, I've pasted in the tracking code using hooks as instructed (I've changed themes dozens of times before with no issues) and GA isn't working. The strange thing is it's picking up me as a visitor in RealTime, but nobody else. Both sites had steady traffic previously. Ezoic (both are on Ezoic) is also not picking up traffic. I was about to switch my big site to GP too, but can't if this is going to happen.
I've cleared Ezoic caching, there's no other caching on them. They're still appearing in the SERPS.
I'm thinking this is down to Google changes with GA4 coming in, so I've also set one up as a GA4 property. And same, it's just tracking me.
Any ideas?
Thanks.

Hi there,

in the <head> of both sites i see two GTAG scripts, both with different IDs.
If your Right Click > Inspect the site in Chrome and in the Developers Tools > Elements tab, expand the head element.
You can use CTR + F to open the finder and search for gtag to jump through them.

See here:

https://www.screencast.com/t/Vvf3ZU9R6u

Not i deleted some elements from that list so as it would all fit on one screen.
Note the green highlight - this is roughly where the wp_head hook exists that GP Elements can insert into, the red box below it is highlighting the second GTA script, and going by its position i assume its the one in the GP Element.

The one at the very top, isn't coming from GP Elements, as to get there requires some kind of proxy injection.
Do you recognise those higher up gtags ?

I'm having the same problem with my site. I can't tell if the problem started with GP or with Autoptimize. It appears my Google Analytics plummeted back in 2021 when I switched my site to GP and started using Autoptimize. Google Search Console seems to be tracking visits and such, but Analytics only tracks my personal admin page visits.

I stepped away from my site for several months and am just realizing this now.

Can anyone help me figure out this problem? Been wracking my brain to figure this out for weeks now.

Thank you!

Hi Lindsay,

Can you open a new topic and link us to your site?

You can use the private info field for site info.

How did you add the Google Analytics code in your previous theme and GP?

No I don't. I didn't think I was using tag manager. This site was previously on Studiopress Genesis and it was very easy to just paste these codes between the <head> tags. Analytics has started tracking now on both the sites I sent to you. Are you still seeing strange code?

No, I've never had to use a plugin for GA code on any of my 8 sites. As the garden site above is my youngest, I'd remember. And it was on a theme I've used for years with no issues. Are you seeing the same thing on the other site I switched to GP?

Would you be able to provide us with a temporary admin login so we can take a look at the backend ?

This archived topic is closed to new replies.