Google Analytics

To enable Google Analytics support in your AMP pages, set up your Google Analytics account, and add the following section parameter:

wf.amp.ga.tracker.id=tracking-id

where tracking-id is your Google Analytics account tracking ID for AMP.

You can optionally override the default behavior of Google Analytics for your AMP pages by providing a custom tracker object configuration in an additional section parameter:

wf.amp.ga.tracker.config=tracker-configuration

where tracker-configuration is a JSON data structure, for example:

{"account":"tracking-id",
"title":"My Title",
"clientId":"client-id"
}

You must use double quotes around the key names and string values in the JSON data you specify, not single quotes.

The Widget Framework merges these section parameters to generate the final tracker configuration that is passed to Google Analytics. So, if tracker-id is not defined in the JSON configuration, it will be collected from the value of wf.amp.ga.tracker.id. However, note that if tracking-id is provided in both wf.amp.ga.tracker.id and as the value of the account key in wf.amp.ga.tracker.config, the latter will take precedence over the former.

For further information about using amp-analytics and its JSON configuration parameters, see the Google Analytics documentation and the AMP Analytics variables list.