I’m using tagDiv AMP Plugin for my blog. I already implement both codes for AMP in Theme Panel as shown below-
Traffic to non AMP pages is counted and showing correctly.But Google Analytics doesn’t count the traffic for the AMP pages.
I was tried both code as –
{
“vars” : {
“gtag_id”: “<GA_TRACKING_ID>”,
“config” : {
“<GA_TRACKING_ID>”: { “groups”: “default” }
}
}
}
And
{
“vars” :{
“account”: “GA_TRACKING_ID″
},
“triggers”:{
“trackPageview”:{
“on”: “visible”,
“request”: “pageview”
}
}
}
Note: I replaced GA_TRACKING_ID with my analytics ID.
So pl. guide me.
Hi,
The analytics code for AMP should be of this form only, please check it
– https://www.screencast.com/t/xL301xKgf
If you enter it like that it will be loaded in AMP pages.
From what I can find online, maybe it would be better to use different tracking for AMP
– https://moz.com/blog/amp-reporting
Thanks
Thanks for your reply,
First,
the link you provided
https://www.screencast.com/t/xL301xKgf
is already implement by me and I told in my question.
and the second link is complete useless for me as there is not clear analytics code, it is only about to channel grouping.
it is ok that some traffic shown under referral section at – www-itkhoj-com.cdn.ampproject.org
but the is only near about 1000 only.
and when I open AMP page, why it doesn’t show in “real time” traffic.
Also there is huge difference in Google Adsense and Google analytics. Google analytics only shows half of the traffic as compared to Google Adsense.
And all this happens after I change the theme.
So I hope instead of giving me screen shot, you provide me actual analytics code which will work in AMP.
Hi,
Please notice that we can not provide analytics code, this would get from google, not from us.
Please check the below documentation.
-> https://support.google.com/analytics/answer/1008080?visit_id=636825367246850618-391037043&rd=1
-> https://developers.google.com/analytics/devguides/collection/amp-analytics/
-> https://support.google.com/adsense/answer/6090783?hl=en
-> https://monetizepros.com/features/5-reasons-why-your-google-adsense-and-analytics-data-dont-match/
Thank you for your understanding.
Hi itkhoj, you have to go in wordpress > Newspaper > AMP > Analytics and remove code from there.
Now, you open your FTP software (i use FileZilla) and you go to: /wp-content/plugins/td-amp/templates and open “html-start.php”
copy this at line 18 under “style”: <script async custom-element=”amp-analytics” src=”https://cdn.ampproject.org/v0/amp-analytics-0.1.js”></script>
copy this at line 23 under “body”:
<amp-analytics type=”gtag” data-credentials=”include”>
<script type=”application/json”>
{
“vars” : {
“gtag_id”: “INSERT YOUR ANALYTICS ID”,
“config” : {
“INSERT YOUR ANALYTICS ID”: { “groups”: “default” }
}
}
}
</script>
</amp-analytics>
Where you see “INSERT YOUR ANALYTICS ID” you have to write your analytics code. CLOSE AND SAVE FILE
My html-start is like this:
-
This reply was modified 7 years by
Ducacordero.
Thank you Ducacordero,
Anybody tried the above solution? There is a problem with the Analytics report and the tagDiv AMP Plugin. It is not matching the page view numbers and the additional test shows that the AMP plugin is not counting the AMP Page visits with GA Code.
The WordPress AMP plugin is displaying the visits properly. However, the tagDiv AMP plugin offers more features related to the theme and can’t get rid of it.
Expecting the solution from the Dev team.
-
This reply was modified 7 years by
kodiyan.
Rikk,
Google Tag Manager has a code to add in website header and footer, right? TagDiv AMP plugin doesn’t have the option to add Header and Footer code in AMP Pages. So how did you achieve this? I’m using Google Tag manager for regular posts, but not working with AMP posts.
Google Analytics can see traffic on: http://www.wesbite.com/postxx/
But it does not count the traffic to: http://www.wesbite.com/postxx/amp/
-
This reply was modified 7 years by
kodiyan.
Yes, it would certainly help if TAGDIV team added an additional field for the secondary code snippet.
I did as Ducacordero stated, put the Google tag manager code in the AMP template. Its only one file edit.
TEAM note .. this is a request. Note also that Google now recommends that everyone use tag manager for implementation of GA code.
-
This reply was modified 7 years by
Rikk.