Themeco Google Analytics add-on stripping piece of code

Hey guys,

I logged into my Google Search Console today to find that my website was marked “not verified”. Obviously it was verified before, but apparently Google attempted to reverify the property and it was unable to, and it gave me this as the reason why: “The Google Analytics tracking code on your site looks malformed.”

I looked into this further and it looks like the Google Analytics add-on is stripping a piece of code from the Analytics tracking code.

Here’s how the code should look, according to Google:

<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_TRACKING_ID');
</script>

Here’s how the code looks after you’ve copied & pasted the code into the Themeco add-on and pressed the UPDATE button:

<!-- Global Site Tag (gtag.js) - Google Analytics -->
https://www.googletagmanager.com/gtag/js?id=UA-[HIDDEN}
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-[HIDDEN]');
</script>

So the add-on is stripping the <script async> tag from Line 2 and only displaying the link.

Is this a bug that needs to be fixed? This is the only way I can verify my site in Search Console as of right now, and I have several other client sites that will need updating after this too.

Hi there,

This is an identified but that was already added in our issue tracker.

For the meantime, please disable Google Analytics plugin and make use of the Insert Header and Footer plugin instead (https://wordpress.org/plugins/insert-headers-and-footers/9).

This should help you resolve the current issue while we have to fix this problem in our bundled plugin.

Thank you for your understanding.

Just a suggestion guys. It’s probably worthwhile having some sort of issues tracker visible for Support Forum users to get an understanding of what issues you’re across, and the prioritisation of said issues.

There’s then possible options for Forum users to vote on issues that they see as more important/urgent, which then ranks them higher, and the Dev Team and then prioritise…

This will also significantly reduce replication of Issues within the Forum. Sometimes you run a search in the Forum to find an issue (eg. me right now in this instance re. Analytics code issues), however sometimes you miss the issue that’s already been raised…

Cheers,
Sam

I would also suggest making an announcement about Google Analytics add-on… given it doesn’t actually work at all at present.

X/Pro users need to know they need to install a completely different plugin for Analytics to actually work correctly.

I haven’t been receiving demographic analytic data on a Site for months now because of this issue. Unbeknownst to me…

Thanks
Sam

Hi There,

Thanks for your valuable suggestion/feedback. We will surly forward this to our leadership team to look on to the matter.
and we will update regarding the same.

Thanks again for your co-cooperation and understanding.

Hey there,

after disabling the bundled plugin I am seeing an issue with code on the front end of the website.
I would just like to reinforce the detail that if you want the error to go away you need to install the header footer plugin so that you can be sure the header code print error goes away from the front end.

cheers !

ENB…//

Hi there,

Thank you for the information. Kindly open up new threads for additional questions as it will help us to focus on each issue and give you a better support which you deserve. Having a long threads makes the maintaining job harder and also it will be harder for the other customers to find the correct information if they have similar issues. You are always welcomed to reply to this thread to follow up the same question.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.