How to Add Google Analytics to AMP Pages in WordPress

December 2, 2019 By Digital Empire

How to Add Google Analytics to AMP Pages in WordPress

If you have implemented the legitimate AMP plugin for WordPress, you’ve got likely found that the plugin strips out the Analytics code from all AMP pages. But besides the fact that the plugin strips it out, AMP pages will still validate with Google Analytics code. However, you need to add Google Analytics to AMP Pages manually.

First, be sure your AMP plugin is up so far, seeing that the modifications can be stripped out when it is updated.

Subsequent, select the Plugins choice in the WordPress admin dashboard, then opt for Editor. From the drop-down on the appropriate, choose AMP, then hit the select button.

On the correct hand sidebar, you’re going to see all of the AMP connected pages accessible for editing.  Towards the backside, you will locate “amp/templates/single.php” after which click on it.

Google Analytics to AMP Pages

Google Analytics to AMP Pages

Scroll down to the conclusion, then place your Analytics javascript code above the </physique> tag.  Then select the “replace the file” button and it’ll store your analytics code into your AMP pages.

Now talk over with any of your AMP pages. And you should still see the page you look at various on your Google Analytics.

For these questioning no matter if here’s allowed, it does accurately validate for AMP if you run it in the course of the Structured records checking out device.

This also the capability that you can sing just how every day (or no longer) using AMP is on your web page.

For those that are looking to get in reality technical, Analytics has a lot more of the technical particulars on the usage of Analytics to AMP Pages. Right here two tabs change content material beneath.

If guys see any problem in adding google analytic to your page, then contact us and send us a message and get it done from our experts.

You can also share the issues in the below comment section. We will get back to you with a solution at the earliest.