google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.21k stars 278 forks source link

Improve support for "Moving Analytics" properties for non Site Kit placed GA snippets #4635

Open jamesozzie opened 2 years ago

jamesozzie commented 2 years ago

Bug Description

For non Site Kit placed Analytics snippets the plugin will auto populate and registered the correct Google Analytics account and property. If a user moves the inserted property to another one of their GA accounts, from their Analytics settings (on the Analytics Web UI) they'll encounter the below notice when visiting their Analytics settings screen within SK:

Error: We've detected there's already an existing Analytics tag on your site (ID UA-200017903-1), but your account doesn't seem to have access to this Analytics property. You can either remove the existing tag and connect to a different account, or request access to this property from your team.

The user may already have access to that property, it's just in a different Google Analytics account to that which SK initially connected to. In this case the notice could be improved, or the plugin could handle these moves better.

Steps to reproduce

  1. Insert a Google Analytics snippet manually or via a third party plugin. I used the GA Analytics plugin as per the impacted user during testing.
  2. Connect the Analytics module, the plugin will pre populate and use that non SK placed snippet
  3. Move that property from within the Analytics platform, to another Analytics account which you are an administrator of
  4. Revisit the Analytics settings with Site Kit
  5. An error is encountered, as the plugin remains connected to the initial GA account

Screenshots

image

Possible fixes

I see two possible solutions.

  1. Textual change: Improve the wording on the notice encountered
+ but your Google account or the connected Analytics account
- but your Google account
  1. Perform a check each time the Analytics settings are visited. The check should be for not just the property, but also the containing Google Analytics account. If the property now belongs to a different GA account the plugin should register this new GA account alongside the property, and display this in the account dropdown field.

Additional Context


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

Acceptance criteria

Implementation Brief

Test Coverage

QA Brief

Changelog entry

jamesozzie commented 2 years ago

As a side note changing the wording isn't an ideal solution. If a user disconnects the Analytics module with Site Kit or even resets the plugin upon reconnecting once more they're stuck in a loop, as the plugin shows the warning each time.

Recording of experience after disconnecting.

image

The only workaround at present is to remove the non Site Kit placed snippet.

aaemnnosttv commented 2 years ago

Thanks @jamesozzie – this sounds like a bit of an edge case but I agree this could lead to an odd experience. With the changes coming to the behavior around existing tags, the user wouldn't be blocked any more as a result of this change but there may be something we can do to ensure the account ID is updated properly.

aaemnnosttv commented 2 years ago

We'll revisit this after the Existing Tag Simplification (#4448) issues are done.

aaemnnosttv commented 1 year ago

@kuasha420 let's look into this to see if the same is possible in GA4 and then we will have a better idea if this is worth addressing or not.

kuasha420 commented 1 year ago

@aaemnnosttv I have verified that it is possible to move GA4 properties across accounts.

Screenshot_20230128_020102

After doing that, the Settings page doesn't show an error but the GA4 property vanishes from the selection and dropdown. It's still shows up in the Settings View.

Screenshot_20230128_021205

So something worth moving forward. Moving this one to AC for further investigation.