Skip to content

Excluding all logged in users from Analytics results in invalid JSON in Web Stories preview debug mode #3572

@LuckynaSan

Description

@LuckynaSan

Bug Description

1.) When you enable the option to exclude all logged in users from Analytics in Site Kit by Google, Story passes AMP validator, but Story's debug mode in the story preview is outputting the below warning
Screen Shot 2021-06-11 at 12 06 36 PM
Screen Shot 2021-06-11 at 12 08 40 PM

Steps to reproduce

  1. Go to Site Kit settings
  2. Click on edit Analytics > Exclude from Analytics all logged-in users
  3. Go to Web Stories
  4. Open in editor > preview a story
  5. See debug tab and notice invalid JSON error

Screenshots

Additional Context

Related Github issue GoogleForCreators/web-stories-wp#7939

  • PHP Version:
  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari] chrome
  • Plugin Version [e.g. 22] 1.34.0
  • Device: [e.g. iPhone6] macOS

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

Acceptance criteria

  • The GA opt-out element output for AMP should not raise any validation errors or warnings for HTML or AMP markup validation

Implementation Brief

Test Coverage

  • No changes

Visual Regression Changes

  • N/A

QA Brief

  • Set up and configure Analytics to exclude tracking for logged in users (default)
  • Enable Web Stories and create a new story
  • Leave blank and click Preview
  • On the preview screen, click the Debug tab
  • Review the results, ensure the __gaOptOutExtension element is not reported (there may be other validation errors/warnings not from Site Kit)

Changelog entry

  • Fix AMP validation error caused by the GA opt-out snippet conditionally placed by Site Kit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Low priorityRolloverIssues which role over to the next sprintType: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions