No data in Google Analytics after switching to X theme

Hi,

I’m having the same issue as the users in this thread:

No data reported but I know I’m getting traffic.

Previously used Yoast, installed Google Analytics from the Pro > Overview page. Entered the Global Site Tag code for my Analytics account.

GA Checker shows all red Xs

J

Hello There,

Thanks for writing in! I have logged in and inspected your page and I could not see the GA code. It seems that this is just a caching issues. I can see that you have installed Autoptimize and SG CachePress. Please clear your caching plugin first before testing your site.

And since you are using SiteGround, could you please clear your site cache or disable the supercacher in your hosting panel? The SuperCacher is developed by SiteGround exclusively for their customers. It increases the number of hits a site can handle and boosts the website loading speed. The SuperCacher includes 4 different caching options for maximum optimization of your websites. You can access the tool by clicking on the SuperCacher icon in your cPanel.

For more information about this, please check it out here: https://www.siteground.com/tutorials/supercacher/supercacher_intro.htm

Hope this helps.

Thanks RueNel.

I cleared all the caches and still am not seeing the google analytics on the home page

I Purged the SiteGround SuperCacher

I flushed the Static Cache on Site Grond

I flushed the Dynamic Cache on SiteGround

I deleted the Autoptimize Cache

Google Tag Assistant confirms that Analytics isn’t loading

These are all the caches that I know of on my server.
What else can we try?

J

Hello J,

This is what I am seeing on the backend.

<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments)};
  gtag('js', new Date());

  gtag('config', 'UA-6246109-1');
</script>

Then on the frontend I am just seeing the comment part:

I tried to update the code and remove the extra script tags and even update the comment to see if it’s working, but then nothing is happening on the frontend. Can you try clearing cache again and disable it for a moment. Having multiple cache might cause this issue. It’s a like caching an already cache content.

Thanks Lely.

All caches have been flushed and turned off.

J

Hello J,

Could you please temporarily deactivate all your caching mechanism? The caching could be the cause of this issue.

And to test more about this issue, you may install this 3rd party plugin, https://wordpress.org/plugins/insert-headers-and-footers/, and insert the GA code in the header settings on this plugin and we’ll see the difference.

Please let us know how it goes.

Thanks RueNel.

I’ve installed the plugin and put the GA code in the header field.

J

Hi J,

I am seeing the code now. See this: https://screencast-o-matic.com/watch/cbQqnOIY5Z
Check the report on google analytics. Note that for report accuracy, code is not added if you’re logged in as admin.

Thanks Lely.

I’m seeing the code now as well

But still no data

And Google Tag Assistant isn’t seeing it, even after clearing browser cache

J

Are you using the correct code? Since it now outputs correctly, it now boils down to if the code is correct or not. Please see the links below.


Regarding, the Google Analytics extension, there’s currently a bug. Please see https://theme.co/apex/forum/t/google-tag-manage-and-google-analytics/8966 for details.

Thanks.

Thanks Christian.

We’ve made some progress.

I could not get the Google Analytics plugin that come with X to work so I uninstalled it and am using the Insert Headers and Footers plugin. That is putting the code in the header.

I also installed the Google Tag Manager code in the header and body (thanks for the link)
I’m now getting clear reports on both the Analytics and Tag Manager but also an error on the Analytics

Detail on the Analytics error

J

Hi J,

See this link on the nature of the error and what to do about it: https://support.google.com/tagassistant/answer/3207128?hl=en#invalid_id

Hope this helps.