Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GA opt-out added even when no tag is set #6364

Closed
aaemnnosttv opened this issue Jan 3, 2023 · 3 comments
Closed

GA opt-out added even when no tag is set #6364

aaemnnosttv opened this issue Jan 3, 2023 · 3 comments
Labels
Module: Analytics Google Analytics module related issues P2 Low priority Rollover Issues which role over to the next sprint Type: Bug Something isn't working

Comments

@aaemnnosttv
Copy link
Collaborator

aaemnnosttv commented Jan 3, 2023

Bug Description

Site Kit's opt-out script for GA that is used for role-based tracking exclusions is being output even when there is no tag set up yet.

In #3294 we updated the tracking opt out to use GA's property-specific method which adds a key to the window global that has the form ga-disable-MEASUREMENT-ID. In this case, the key is being added even though there is no measurement ID provided. This is harmless but is clearly incorrect and should be cleaned up.

Steps to reproduce

  1. Activate Analytics but do not complete the module setup
  2. See opt-out script on front-end while logged in with no tag after the ga-disable-

Screenshots

image


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

Acceptance criteria

  • The GA tracking opt-out should only be output when there is a configured property ID

Implementation Brief

  • In includes/Modules/Analytics.php:
    • Update the print_tracking_opt_out() method:
      • After the $property_id variable is assigned, check if it is empty. If $property_id is empty, return early so that the method is terminated immediately.

Test Coverage

  • In tests/phpunit/integration/Modules/AnalyticsTest.php:
    • Update test case(s) accordingly.

QA Brief

  • Verify opt-out functionaly works as expected.
  • Verify tracking data is sent to Analytics.

Tag output

  • Enable Analytics but cancel Setup, so Analytics is enabled but not configured.
  • Verify the opt-out code from AC screenshot it not added.
  • Setup Analytics
  • Verify the opt-out code is now added.

Changelog entry

  • Skip outputting measurement ID specific Google Analytics disabling script when no measurement ID is configured.
@aaemnnosttv aaemnnosttv added Type: Bug Something isn't working P2 Low priority Module: Analytics Google Analytics module related issues labels Jan 3, 2023
@sashadoes sashadoes assigned sashadoes and unassigned sashadoes Jan 3, 2023
@nfmohit nfmohit assigned nfmohit and unassigned nfmohit Jan 8, 2023
@eugene-manuilov eugene-manuilov self-assigned this Jan 9, 2023
@eugene-manuilov
Copy link
Collaborator

IB ✔️

@eugene-manuilov eugene-manuilov removed their assignment Jan 9, 2023
@derweili derweili self-assigned this Jan 10, 2023
@derweili derweili added the QA: Eng Requires specialized QA by an engineer label Jan 10, 2023
@aaemnnosttv
Copy link
Collaborator Author

@derweili is this still in progress? The PR looked like it might have been ready for review. I left one comment but otherwise LG2G 👍

@derweili derweili assigned aaemnnosttv and unassigned derweili Jan 11, 2023
@aaemnnosttv aaemnnosttv removed their assignment Jan 11, 2023
@aaemnnosttv aaemnnosttv removed the QA: Eng Requires specialized QA by an engineer label Jan 11, 2023
@mxbclang mxbclang added the Rollover Issues which role over to the next sprint label Jan 13, 2023
@wpdarren wpdarren self-assigned this Jan 16, 2023
@wpdarren
Copy link
Collaborator

QA Update: ✅

Verified

  • With Analytics cancelled during setup, the opt-out code from AC screenshot it not added.
  • With Analytics connected, the opt-out code is now added.
  • Opt-out functionality works as expected and tracking data is sent to Analytics.
    • Disabled snippets and opt-out code does not appear.
Details
optout.mp4

image
image

@wpdarren wpdarren removed their assignment Jan 17, 2023
@aaemnnosttv aaemnnosttv self-assigned this Jan 27, 2023
@aaemnnosttv aaemnnosttv removed their assignment Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: Analytics Google Analytics module related issues P2 Low priority Rollover Issues which role over to the next sprint Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants