site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Tag detection during Analytics setup flow does not display until an account is selected.

Open adamsilverstein opened this issue 7 years ago • 5 comments

Bug Description

When testing in jurassic ninja, tag detection results during Analytics setup flow does not display until an account is selected from the dropdown.

Originally reported in QA: https://github.com/google/site-kit-wp/issues/744#issuecomment-550500357

Steps to reproduce

  1. Create a new test site using http://jurassic.ninja/
  2. Install the site kit plugin zip from develop (npm run release-zip)
  3. Install an analytics plugin - tested with Analytify - Google Analytics Dashboard and GA Google Analytics and use it to add an analytics tag to the site
  4. Configure Site Kit Analytics, notice that the tag does not appear to be detected, no message is shown (initially):

image

  1. Select an account from the first dropdown, note the tag detection message appears:

image

Expected Results

The tag detected message should appear immediately.

Although broken in jurassic ninja, this doesn't happen to me locally so I'm not certain the source of the issue. Here is what I see in my local:

image

Additional Context

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

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

Acceptance criteria

  • Tag detection for an existing Analytics tag should run immediately in the module setup screen, and display its results without requiring user interaction.

Implementation Brief

  • Change https://github.com/google/site-kit-wp/blob/66f7cda16defc27758629e6ae7d8577420050891/assets/js/modules/analytics/setup.js#L692-L702 to not require selectedProfile be truthy.
  • In fact, the above method is inappropriately named from what I can tell—it's just about ensuring there is a tag on the page, and it's only used in this component to check that. A property is often pre-selected locally (that's what I was seeing), I believe because the site's URL matches existing ones in your GA account. So the check is already being ran but the fact that we found an existing tag is being ignored until a property is selected, either by the user or automatically. So we could really just change https://github.com/google/site-kit-wp/blob/66f7cda16defc27758629e6ae7d8577420050891/assets/js/modules/analytics/setup.js#L949-L951 to check for existingTag && existingTag !== googlesitekit.admin.trackingID

(In fact, I did the above and it worked for me locally and on a Jurassic Ninja site, so setting the time estimate here as well.)

Changelog entry

  • Fix bug in Analytics module setup where the user would not be informed about an existing tag before selecting a property.

adamsilverstein avatar Nov 06 '19 21:11 adamsilverstein

IB ✅

felixarntz avatar Nov 17 '19 16:11 felixarntz

@felixarntz I've created a PR for the Analytics change, but the AC also mentions AdSense. After digging into this for a bit, I found that there appears to be a bug with existing tag detection and how it affects the behavior.

It appears that an existing tag for AdSense only appears to be presented to the user if the authenticated Google account does not have (or have access to) to any AdSense accounts. The existing tag is detected, but if the user has access to an AdSense account Site Kit appears to continue with setup as usual. Due to the high degree of complexity around the getAdSenseAccountStatus function, I think it makes more sense to address these separately as even the discovery done here has caused this to grow well over the initially estimated size.

Moving to blocked for now until we decide how to handle this one.

aaemnnosttv avatar Nov 25 '19 15:11 aaemnnosttv

@aaemnnosttv That makes sense. Can you open a separate issue for the AdSense part and add your findings to the issue description? Let's move forward with this one only focused on Analytics (I updated the ACs).

felixarntz avatar Nov 27 '19 07:11 felixarntz

Tested Started a new Jurassic Ninja site, installed and activated Analytify adding the tag to my site image

installed and activated GA adding the tag to my site image

Placed the tag on my site: image

Verified during the Analytics setup that the tag was found immediately. See test below

https://drive.google.com/file/d/1UN3l1CGl8e6XtS-2AFyibxkDxS4_6a9B/view

Passed QA ✅

cole10up avatar Dec 11 '19 22:12 cole10up

👁👍

marrrmarrr avatar Dec 17 '19 18:12 marrrmarrr