• Resolved Raja Anbazhagan

    (@rajaanbazhagan)


    I want to capture the CLS value from AMP pages using the following setup.

    {
      "optoutElementId": "__gaOptOutExtension",
      "vars": {
        "gtag_id": "UA-111713316-1",
        "config": {
          "UA-111713316-1": {
            "groups": "default",
            "site_speed_sample_rate": 100,
            "linker": {
              "domains": [
                "springhow.com"
              ]
            }
          }
        }
      },
      "triggers": {
        "Web-Vitals-CLS": {
          "on": "hidden",
          "vars": {
            "event_category": "Web Vitals",
            "event_action": "CLS",
            "event_value": "${cumulativeLayoutShift}"
          }
        }
      }
    }

    However, I don’t see the event firing. What am I doing wrong?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thanks for reaching out. You’ll find an example snippet you can use to capture your Core Web Vitals in this AMP playground. It looks like you have the invalid trigger “Web-Vitals-CLS”.

    Please try use the code from the example playground before or from the previously shared documentation before checking once more.

    Thread Starter Raja Anbazhagan

    (@rajaanbazhagan)

    Hi Thanks for replying. Both the document and the AMP playground shows the same example which I have hard time converting into a GA event/trigger.

    The information I need is this. The analytics section in your plugin takes a vendor name and a json for config. Can you show an example where I can use the ${cumulativeLayoutShift} macro and pass it to google analytics as an event?

    Rather than applying your own analytics configurations have you tried adding the snippets as per playground directly into your child theme files? If so all you need to so id replace the placeholder UA- property with your own.

    I’m happy to check your setup once you’ve done so to ensure it’s configured correctly.

    As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you require any further assistance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can’t collect core web-vitals in AMP using gtag’ is closed to new replies.