Community
Can Lytics collect data from Accelerated Mobile Pages?
over 1 year ago by Mark Hayden
It is possible to send data into Lytics from Accelerated Mobile Pages (AMP) using the amp-analytics component by treating Lytics as an in-house analytics provider.
<amp-analytics>
<script type="application/json">
{
"transport": {
"beacon": false,
"xhrpost": false,
"image": true
},
"vars": {
"anonymousId": "CLIENT_ID(AMP_ECID_GOOGLE,,_ga)",
"cid": "[your lytics cid]"
},
"requests": {
"host": "https://api.lytics.io/c",
"base": "${cid}?amp_id=${anonymousId}&url=${canonicalUrl}&_ul=${browserLanguage}&_ref=${documentReferrer}&_sz=${screenWidth}x${screenHeight}&_v=amp",
"page": "${host}/${base}_e=pv&name=${name}",
"track": "${host}/${base}&event=${event}"
},
"triggers": {
"page": {
"on": "visible",
"request": "page"
}
},
"linkers": {
"lytics": {
"_uid": {
"l_amp_id": "${anonymousId}"
},
"proxyOnly": false
}
},
"cookies": {
"_ga": {
"value": "LINKER_PARAM(lytics, l_amp_id)"
}
}
}
</script>
</amp-analytics>