Analytics
3.8K members online now
3.8K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

AMP analytics

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

What is the function of "trackPageviewWithAmpdocUrl" in AMP analytics? Does it allow us to track the AMP page as a different URL? I'm wanting to combine AMP page and non-amp page (the canonical page) activity in GA. I tried entering the canonical URL as ampdocURL but it didn't work, page was tracked as the AMP page URL. Can anyone help?

 

<amp-analytics type="googleanalytics" id="analytics1">
<script type="application/json">
{
"vars": {
"account": "UA-1234567-1"
},
"triggers": {
"trackPageviewWithAmpdocUrl": {
"on": "visible",
"request": "pageview",
"vars": {
"title": "my page title",
"ampdocUrl": "//www.mysite.org/index.cfm?pg=test"
}
}
}
}
</script>

2 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Jim G
October 2016

AMP analytics

Rising Star
# 3
Rising Star

Tracking both in the same property is highly discouraged.  If you need to combine the two data sets, I recommend using the free Google Data Studio to display the data together.

If you MUST combine the two :-) I recommend creating a new view and doing the url rewrite as a filter.  https://support.google.com/analytics/answer/1034834?hl=en

 

_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

View solution in original post

AMP analytics

[ Edited ]
Top Contributor
# 2
Top Contributor

edited - Scrap my earlier suggestion since the dev docs suggest tracking the amp pages with a seperate property

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here
Marked as Best Answer.
Solution
Accepted by topic author Jim G
October 2016

AMP analytics

Rising Star
# 3
Rising Star

Tracking both in the same property is highly discouraged.  If you need to combine the two data sets, I recommend using the free Google Data Studio to display the data together.

If you MUST combine the two :-) I recommend creating a new view and doing the url rewrite as a filter.  https://support.google.com/analytics/answer/1034834?hl=en

 

_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

AMP analytics

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Thanks for the reply Phillip. I'll try the url rewrite method you suggested although it sounds challenging. I'd like to create a new property for this, so I'd have a non-AMP property, an AMP property and a new Aggregate property. I found info about adding two tracking codes for universal analytics, but not for AMP analytics. Do you know if its possible?  My goal is to get a report showing the combined total of page views for each AMP page and its non-AMP equivalent.

 

AMP analytics

Rising Star
# 5
Rising Star

Just put in two separate <amp-analytics> tags 

 

_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

AMP analytics

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Many thanks Phillip. I did the URL rewrite and added the two tracking codes as you suggested and it seems to be working perfectly.

 

Re: AMP analytics

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

Hey Phillip.  I don't understand why it is discouraged.  Having AMP separate to our regular Web traffic is very problematic in understanding what works and what doesn't.  There is no way to understand well the consolidated numbers, and there is also not a good way to evaluate how users coming from AMP behave.  As the data is separated.  I am not sure I even understand what the logic is to separate it to begin with