Reputation: 43
We implemented AMP to our site a couple of months ago. We're tracking visits correct in Google Analytics but the speed dimensions are empty, we have no sample pages measured.
How can I get the load time in amp pages?
In amp-analytics config I put 'site_speed_sample_rate' => 100 in order to track all the pages.
self::$triggers['trackPageview'] = [
'on' => 'visible',
'request' => 'pageview',
'vars' => [
'account' => $this->environment->getCodigoAnalitics(),
'site_speed_sample_rate' => 100
]
];
I expect to get the load timings but all i've got is 0s in all amp pages.
Upvotes: 0
Views: 151
Reputation: 190
I may be late but hope someone might find it useful. Various AMP features allow variables to be used inside of strings and substituted with the corresponding actual values. ${contentLoadTime}
is one of them.
"triggers": {
"trackGA": {
"selector": "amp-layout",
"on": "visible",
"request": "event",
"vars": {
"eventAction" : "ContentLoadTime",
"eventCategory": "${contentLoadTime}"
}
}
}
link to the whole list : https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md
Upvotes: 0