• Resolved Rodrigo

    (@vejapixel)


    1- Would the Google Analytics code for the AMP version be the code below?

            {
                "vars":{
                    "account":"UA-XXXXXXXX-X"
                },
                "triggers":{
                    "trackPageview":{
                        "on":"visible",
                        "request":"pageview"
                    }
                }
            }

    Google Analytics has a new version of the tracking code, a code that starts with G-.
    The AMP code remains the same for this new version of Google Analytics (G-), just changing the UA- code to the G- code as shown below?

            {
                "vars":{
                    "account":"G-XXXXXXXXXX"
                },
                "triggers":{
                    "trackPageview":{
                        "on":"visible",
                        "request":"pageview"
                    }
                }
            }

    2- And is the Facebook tracking code different for the AMP version as well?
    If so, then what is the Facebook code format for AMP?

Viewing 1 replies (of 1 total)
  • Thanks for reaching out. If you’re using Google Analytics 4 note that this is not fully supported in AMP just yet. You can subscribe to the below GitHub issue in relation to this:
    https://github.com/ampproject/amphtml/issues/24621

    In relation to the Facebook tracking code in order to comply with AMP framework guidelines the tracking code uses a non JavaScript format. You’ll find out more on this on the respective amp.dev Facebook pixel page. Be sure to enter facebookpixel as the “Type” within your Analytics configuration.

Viewing 1 replies (of 1 total)

The topic ‘Google Analytics and Facebook codes for AMP’ is closed to new replies.