Search code examples
google-analyticsamp-html

After setting up amp-analytics on my AMP where can I see the tracked data in Google Analytics?


So I've set up my page with amp-analytics and linked it to my GA account using my ID. I'm using this code for the amp component:

<amp-analytics type="googleanalytics" id="analytics1">
        <script type="application/json">
            {
            "vars": {
                "account": "MY-ACTUAL-ID"
            },
            "triggers": {
                "trackPageview": {
                "on": "visible",
                "request": "event",
                "visibilitySpec": {
                    "selector": "#sponsored_content_1",
                    "visiblePercentageMin": 20,
                    "totalTimeMin": 500,
                    "continuousTimeMin": 200
                },
                "vars": {
                    "eventId": "sponsor-view"
                }
                },
                "trackAnchorClicks": {
                    "on": "click",
                    "selector": "a#sponsored_content_1",
                    "request": "event",
                    "vars": {
                        "eventId": "clickOnSponsorAnchor"
                    }
                }
            }
            }
        </script>
    </amp-analytics>

My question is: Where do I actually see the info this is tracking inside Google Analytics?


Solution

  • Since you've sent "event" requests to GA, you can see them under Behaviour > Events > Overview.

    I'd recommend in the vars section of your config to add eventCategory, eventAction (and eventLabel) properties, as these get pulled in GA and can be viewed readily e.g.

        "vars": {
          "eventId": "clickOnSponsorAnchor"
          "eventCategory": "Sponsor Clicks",
          "eventAction": "Anchor click"
        }