I implemented AMP pages and they are indexed with no errors and appear in Google search. When a visitor clicks on a link on Google SERP then they appear on Google Analytics (including cached pages) as referenced from organic/google
. But when a visitor clicks on a link on that AMP page then the referrer is sometimes expected referral/ampprogect.org
and in many cases direct/none
.
Of course, amp-analytics
is set.
I suspect that direct/none
appear when AMP pages served from the main server in response to a click from cached page.
Just in case, AMP were published a few days ago and not all have been discovered by now.
Does it make any sense?
Amp-analytics is implemented in a very basic way
<amp-analytics type="googleanalytics">
<script type="application/json">
{
"vars": {
"account": "UA-XXXXX-Y" //real account id for sure
},
"triggers": {
"trackPageview": {
"on": "visible",
"request": "pageview"
}
}
}
</script>
</amp-analytics>
Update
I set up Google Tag Manager for AMP and changed amp-analitics
block with
<amp-analytics config="https://www.googletagmanager.com/amp.json?id=GTM-zzzzzz>m.url=SOURCE_URL" data-credentials="include"></amp-analytics>
with the same result.
The click from cached AMP
page (that is https://google.com/mydomain-com.cdn...
) to non-amp shows referral/ampproject.org
and click on non-cached AMP (that is https : //mydomain.com/amp/something.aspx
) shows direct/none
.
Thanks to this great post I understood what goes wrong and applied the ideas to
.NET
. The main idea is to catchamp-analytics
configuration object (JSON formatted) and replace it with my own (withclientId
inside).First I created
HttpHandler
Next I registered it in
web.config
.and finally put into
amp-analytics
tag.Now all clicks from cached and non-cached AMP pages show
organic/google
.