Sponsored Content
The Wayback Machine - https://web.archive.org/web/20220409064739/https://github.com/google/site-kit-wp/issues/727
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

Opt In/out should take effect immediately #727

Closed
adamsilverstein opened this issue Oct 28, 2019 · 6 comments
Closed

Opt In/out should take effect immediately #727

adamsilverstein opened this issue Oct 28, 2019 · 6 comments
Labels
P1 Type: Bug
Milestone

Comments

@adamsilverstein
Copy link
Collaborator

@adamsilverstein adamsilverstein commented Oct 28, 2019 •

Bug Description

Follow up for issues discovered during QA of #633.

  • Checking or unchecking the opt in to tracking checkbox, then immediately performing an action (without a page refresh) doesn't work correctly during setup flow or on settings screen.

Steps to reproduce

I see the same issue in two locations.

Setup flow

image

  • During the plugin setup I am given the option to opt in to tracking (or opt out if I opted in from the plugin activation banner).
  • If I opt in to tracking, then click on "Sign In With Google" the first tracking event is not sent correctly. gtag is undefined and googlesitekit.admin.trackingOptin is still false
  • Similarly if I arrive with tracking enabled having enabled it on the plugin activation screen, then try to opt out, the first tracking event is still sent because googlesitekit.admin.trackingOptin is still true.

Settings screen

image

  • Arriving at the settings screen with tracking disabled, I go to settings->admin and enable tracking. I then go to "Connect More Services (without refreshing) and activate Analytics. the first activation tracking event is not sent correctly. gtag is undefined and googlesitekit.admin.trackingOptin is still false.
  • Similarly if I arrive with tracking enabled , then try to opt out, the first tracking event is still sent because googlesitekit.admin.trackingOptin is still true.

Screenshots

Screenshots above.

Additional Context

  • PHP Version: 7.3
  • OS: [e.g. iOS] OSX
  • Browser [e.g. chrome, safari] Chrome Dev
  • Plugin Version [e.g. 22] develop branch also tested fix/633-opt-in-window
  • Device: [e.g. iPhone6] Macbook Pro

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

Acceptance criteria

  • Opting in to tracking or opting out of it should immediately take effect, with the following event being fired or not fired accordingly.
  • Let's consistently rely on one specific global variable window.googlesitekitTrackingEnabled for whether tracking is enabled or not, and remove the other one(s).

Implementation Brief

  • Change all references to googlesitekit.admin.trackingOptin to use window.googlesitekitTrackingEnabled
  • Update sendAnalyticsTrackingEvent to only read/use window.googlesitekitTrackingEnabled instead of the current googlesitekit.admin.trackingOptin (this will require updating its E2E test as well).

Changelog entry

  • Ensure that opting in or out of tracking takes effect immediately.
@adamsilverstein adamsilverstein added the Type: Bug label Oct 28, 2019
@felixarntz
Copy link
Member

@felixarntz felixarntz commented Oct 28, 2019

In the non-React version, this relies on window.googlesitekitTrackingEnabled instead of googlesitekit.admin.trackingOptin. Maybe we should consistently decide on one of the two and use that value throughout (I'd vote for the first since that doesn't rely on an extra admin object to exist).

@tofumatt
Copy link
Collaborator

@tofumatt tofumatt commented Oct 28, 2019

Agreed, let's use the same value everywhere; it's a bit confusing to have to handle two different values. (Leading to this bug/confusion!)

@felixarntz felixarntz assigned tofumatt and unassigned felixarntz Nov 4, 2019
@tofumatt tofumatt assigned felixarntz and unassigned tofumatt Nov 11, 2019
@felixarntz
Copy link
Member

@felixarntz felixarntz commented Nov 17, 2019

IB ✅

@felixarntz felixarntz removed their assignment Nov 17, 2019
@tofumatt tofumatt self-assigned this Nov 26, 2019
@tofumatt tofumatt assigned aaemnnosttv and felixarntz and unassigned tofumatt Nov 26, 2019
@felixarntz felixarntz added this to the 1.1.2 milestone Nov 27, 2019
@tofumatt tofumatt removed their assignment Nov 27, 2019
@cole10up cole10up self-assigned this Nov 28, 2019
@cole10up
Copy link

@cole10up cole10up commented Nov 28, 2019

Tested

Confirmed during setup that opt in takes effect immediately and the setting is retained in the admin section
image

image

Confirmed opt out functions the same during setup and into admin

image

image

ONE THING TO NOTE
Opting out isn't sticky on the same page.
Steps:

  1. Have user opted in and navigate to the admin page
    image

  2. Click opt out by unchecking the box
    image

  3. Navigate to one of the other settings tabs in the admin
    image

  4. Navigate back to the admin tab

Notice box is still checked
image

If user refreshes the page the check is gone and the admin shows opted out
image

Please review if this is acceptable.

@cole10up cole10up removed their assignment Nov 28, 2019
@tofumatt
Copy link
Collaborator

@tofumatt tofumatt commented Nov 28, 2019

It being opted-in after the user opts-out isn't good; I'll take a look at that and try to push a fix now…

@tofumatt tofumatt self-assigned this Nov 28, 2019
tofumatt added a commit that referenced this issue Nov 28, 2019
@tofumatt tofumatt assigned aaemnnosttv and felixarntz and unassigned tofumatt Nov 28, 2019
@cole10up cole10up self-assigned this Dec 2, 2019
@cole10up
Copy link

@cole10up cole10up commented Dec 3, 2019

Tested

Setup while selecting opt-in and navigated to the admin page to confirm it took effect
image

Unchecked box to opt out
image

Navigated to a different tab within the window
image

Navigated back to Admin tab
image

Checked general functionality with opting out, refreshing page, navigating around and back to the admin. All looks good.

Passed QA ✅

@cole10up cole10up removed their assignment Dec 3, 2019
@felixarntz felixarntz closed this Dec 5, 2019
@ThierryA ThierryA removed this from the 1.1.2 milestone Feb 3, 2020
@ThierryA ThierryA added this to the Sprint 12 milestone Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 Type: Bug
Projects
None yet
Development

No branches or pull requests

7 participants