google / google/site-kit-wp

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

Open
#4,635 5 comments 0 reactions 1 assignee Claimed by @benbowler View on GitHub
Language Module: Analytics P2 Type: Bug Type: Support
Dominant language
JavaScript
Stars
1.4k
Forks
383
Avg merge
4d 12h
Merged PRs (30d)
80

Description

## 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](https://support.google.com/analytics/answer/6370521#about&zippy=%2Cin-this-article) 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](https://wordpress.org/plugins/ga-google-analytics/) 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](https://support.google.com/analytics/answer/6370521#about&zippy=%2Cin-this-article) 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](https://user-images.githubusercontent.com/41326532/148934468-83b4b893-6689-4c70-b6b1-de9645965f51.png)

## Possible fixes

I see two possible solutions.

1. Textual change: Improve the wording [on the notice encountered ](https://i.imgur.com/g66sVPo.png)

```diff
+ but your Google account or the connected Analytics account
- but your Google account
```

2. 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

- [Support topic where this came up](https://wordpress.org/support/topic/another-weve-detected-theres-already-an-existing-analytics-tag-issue/)
- [Internal testing with further details](https://app.asana.com/0/1185360131189553/1201637033347817/f)
- [Recording of experience](https://recordit.co/7o9U8CYIV0)
- For SK placed snippets the experience is much improved, with the [warning more appropriate](https://i.imgur.com/80Ie1TX.png) and the user being able to change the connected GA account and property when revisiting the SK Analytics settings.

---------------

_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

*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.