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

Google Tag settings are not saved when creating a new tag using Set up a new property in Analytics settings #6767

Closed
mxbclang opened this issue Mar 23, 2023 · 4 comments
Labels
Module: Analytics Google Analytics module related issues P0 High priority Type: Bug Something isn't working

Comments

@mxbclang
Copy link

mxbclang commented Mar 23, 2023

Bug Description

This issue was discovered in Bug Bash by @mohitwp and @techanvil.

When creating a new Google tag as a result of selecting "Set up a new property" in the Analytics settings, upon creation of the property, the Google tag settings can be seen to be set, for example here in the JS console.

image

However, refresh the page, and the settings vanish, either having become unset, or not being saved in the first instance:

image

In this situation, there is no Google tag setting so the front-end will use the measurement ID in the gtag.

Steps to reproduce

  • Site up Site Kit with Analytics connected and the gteSupport feature flag enabled.
  • Navigate to the Analytics settings page, select "Set up a new property" in the GA4 property dropdown, and press Confirm Changes (going through the OAuth flow if necessary).
  • With the property created, while still on the settings view, call the getSettings() selector, where the Google tag settings can be seen to be set. However these do not appear to be persisted in the backend. Note, do not navigate to the Dashboard as this may trigger the Google tag sync.
googlesitekit.data.select('modules/analytics-4').getSettings()
  • Open the front-end of WordPress in a separate tab and view the source - the measurement ID will be used in the Analytics snippets, rather than the expected Google tag ID.
  • Refresh the settings page and check the settings in the JS console again - the Google tag settings will no longer be set.

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

Acceptance criteria

  • When GTE support is enabled, upon creating a new property in the Analytics settings page, the corresponding Google tag settings should be persisted.
  • The new Google tag ID should be used in the Analytics snippets.
  • Refreshing the settings page should show the Google tag settings have been persisted.

Implementation Brief

  • In assets/js/modules/analytics-4/datastore/settings.js:
    • Within the submitChanges function, add await before both the dispatch calls to updateSettingsForMeasurementID.

Test Coverage

  • No new tests required.

QA Brief

  • Site up Site Kit with Analytics connected and the gteSupport feature flag enabled.
  • Navigate to the Analytics settings page, select "Set up a new property" in the GA4 property dropdown, and press Confirm Changes (going through the OAuth flow if necessary).
  • Open the front-end of WordPress in a separate tab and view the source - the tag ID should be the new Google tag ID, not the Measurement ID we would use when GTE is not enabled.
  • Refresh the settings page and check the settings in the JS console using googlesitekit.data.select('modules/analytics-4').getSettings() - the Google tag just created should be returned.

Changelog entry

  • Fix bug where Google Tag settings were not being saved when creating a new tag via the Analytics Settings page.
@mxbclang mxbclang added P0 High priority Module: Analytics Google Analytics module related issues Type: Bug Something isn't working labels Mar 23, 2023
@techanvil techanvil assigned techanvil and unassigned techanvil Mar 23, 2023
@jimmymadon jimmymadon assigned jimmymadon and unassigned jimmymadon Mar 27, 2023
@tofumatt tofumatt self-assigned this Mar 28, 2023
@tofumatt
Copy link
Collaborator

IB ✅

@tofumatt tofumatt assigned tofumatt and unassigned tofumatt Mar 28, 2023
@techanvil techanvil assigned techanvil and unassigned techanvil Mar 30, 2023
@mohitwp mohitwp self-assigned this Mar 31, 2023
@mohitwp
Copy link
Collaborator

mohitwp commented Apr 3, 2023

QA Update ⚠️

@tofumatt

I setup analytics a/c with 'gteSupport' feature flag enabled and "Set up New Property" under analytics settings view. Now Google tag is getting save when we refresh settings page.
But I've a question regarding below point mentioned under QAB-
Open the front-end of WordPress in a separate tab and view the source - the measurement ID should be the new Google tag ID.

Currently, when gteSupport feature flag is enabled and google tag starting with 'GT -' also available, then that tag appear as Google Tag under source code instead of measurement ID. If we disabled gteSupport then only Measurement ID set as a Google Tag ID. As I remember, this is the logic we are following.
So, Are we going to set Measurement ID as a new Google ID when gteSupport Feature flag enabled and tag starting with 'GT-' is also available ?

when 'getSupport' feature flag is enabled -

image

When getSupport feature flag is disabled

image

Settings view -

image

@tofumatt
Copy link
Collaborator

tofumatt commented Apr 3, 2023

@mohitwp It looks like what is happening there is correct—the GTE tag (eg the GT- tag) is being used when GTE Support is enabled.

When it's disabled, the Measurement ID is being used.

I've updated the QA Brief a bit to clarify that—the wording was admittedly a bit confusing 😅

@tofumatt tofumatt removed their assignment Apr 3, 2023
@mohitwp
Copy link
Collaborator

mohitwp commented Apr 3, 2023

QA Update ✅

Thank you ! @tofumatt

  • Tested on dev.
  • Successfully created new property.
  • Google tag settings is getting save when we create new property.
  • Refreshing the settings page showing the newly created google tag when we check using googlesitekit.data.select('modules/analytics-4').getSettings()
Recording.285.mp4

@mohitwp mohitwp removed their assignment Apr 3, 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 P0 High priority Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants