October 2017
Intermediate to advanced
370 pages
8h 57m
English
Timer triggers can be used to track the amount of time a user spends on a page. Google Analytics can already track time spent on a page using the difference between the pageview timestamps. However, if there is only one pageview, then Google Analytics can't track time accurately. That's where timer triggers come in. The following will send events every 15 seconds, to a maximum of 600 seconds (/ch10/ga-timer.html):
"triggers": { "pageTimer": { "on": "timer", "timerSpec": { "interval": 15, "maxTimerLength": 600 }, "request": "event", "vars": { "eventCategory": "pagetime", "eventAction": "Engaged ${totalEngagedTime}", "eventLabel": "${ampdocUrl}" } }}
In this example, note the following:
Read now
Unlock full access