Skip to content

AMP: Add support for tagging with GA4 #7221

@aaemnnosttv

Description

@aaemnnosttv

Feature Description

Until now, AMP's Analytics integration has not supported GA4. Now that it does, Site Kit should be updated accordingly.

See https://developers.google.com/analytics/devguides/collection/amp-analytics/


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • GA4 should add/extend the amp-analytics tag with its configured measurement ID as per the spec

Implementation Brief

  • Extend UA AMP tag to include GA4 tag ID (when UA tag is going to render)
  • Otherwise, use existing AMP tag with GA4 tag ID (similar to approach taken with GA4 web tag)
  • Finish and merge Add foundation for GA4 with AMP. #7224

Test Coverage

  • Tag classes are currently without tests; given the urgency here we can follow this convention and follow-up with added coverage

QA Brief

  • This issue changes the way AMP tags are rendered, integrating the GA4 tag with the UA tag when present, otherwise placing the same amp-analytics tag with only the GA4 ID if UA is not connected or snippet is not enabled
  • This should only affect GA in AMP and support only UA, only GA4, or both enabled.
  • The realtime report in GA can be used to see data come in (there is some delay but you should see hits come through within 30-60s)

Changelog entry

  • Add support for tagging with Google Analytics 4 in AMP mode

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions