question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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 https://github.com/google/web-stories-wp/issues/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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
aaemnnosttvcommented, Jun 23, 2021

@wpdarren actually, sorry, it should be good – I just tested this again and while there are errors that show Site Kit, it’s mostly because the output is minified and line 6 starts with our opt-out comment there which is normal. The main error we don’t want to see is the first one in your screenshot there about invalid JSON.

Here’s what I see image

0reactions
wpdarrencommented, Jun 24, 2021

QA Update: Pass ✅

  • The invalid JSON is not reported as per the QAB.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the Invalid JSON Error in WordPress? - Rank Math
In this article, learn how to fix the invalid JSON error - 'Updating failed. The response is not a valid JSON response.' with...
Read more >
How to Fix the Invalid JSON Response Error in WordPress
One of the most common causes of the invalid JSON response error is an issue with your site's .htaccess file and/or WordPress permalinks....
Read more >
How to Stop Google Analytics from Tracking Logged In ...
Automatically Exclude Logged-In Users from Tracking (Easy Way). There're many ways to stop tracking WordPress admin visits in Google Analytics.
Read more >
How to Fix The Invalid JSON Error in WordPress (Beginner's ...
Here's our step by step guide on how to fix the invalid JSON ... After that, WordPress will keep a log of all...
Read more >
failed to install with npm, invalid json response - Stack Overflow
Viral Patel comment solved it for me. Problem was solved by cleaning the local cache with. npm cache clean --force.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found