It is obvious that you must check JSON validity; not for the whole thing, but only what’s inside <script>
tag. There a lot of online tools for that, one example would be this. Anyway, here is my “whole raw thing” that is working great:
<amp-analytics type="googleanalytics" id="analytics1">
<script type="application/json">
{
"vars": {
"account": "UA-00000000-0"
},
"triggers": {
"trackPageview": {
"on": "visible",
"request": "pageview"
},
"trackClickOnSomeShit" : {
"on": "click",
"selector": ".dummy_any_css_selector",
"request": "event",
"vars": {
"eventCategory": "DummySomeCategory",
"eventAction": "DummySomeAction"
}
}
}
}
</script>
</amp-analytics>
Please note that there is some event tracking included, and that is not mandatory. But I just wanted to include whole thing.
-
This reply was modified 7 years, 11 months ago by cvladan.