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

Reorganize Google Tag Manager snipped and initialization #7167

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

peterhudec
Copy link
Contributor

Description of change

This PR fixes an issue introduced with #7008 when Google Analytics events have not been sent because the app set default consent to denied for the whole of Data Hub and not just the Export Wins Review part.

Test instructions

  1. Start a local instance of Data Hub which has the GOOGLE_TAG_MANAGER_KEY env var set to an ID of an existing container in Google Tag Manager.
  2. Go to [Google Tag Assistant] (you might have to install a browser extnsion for it to work)
  3. Connect the tool to your local instance by clicking on the Add domain button and typing http://localhost:3000 (or whatever is the address of your Data Hub instance) into Your website's URL field and click the Connect button and then the Continue button, which should open http://localhost:3000 in a new tab
  4. In the [Google Tag Assistant] you should see a log of numbered events
  5. The event #1 should be Consent Initialization, click on it
  6. In the event's Output pane, click on the Consent tab
  7. It should read "Consent not configured, Default consent state has not been set yet"
  8. When you interact with Data Hub in the new tab opened by [Google Tag Assistant]
  9. You should see events appearing in the [Google Tag Assistant]
  10. Disconnect the tab with Data Hub from [Google Tag Assistant] by clicking on the big cross in the top-left corner
  11. Repeat step 3, but this time type http://localhost:3000/exportwins/review/<token> into the Your website's URL field
  12. Again, you should see a log of numbered events in the Google Tag Assistant you should see a log of numbered events
  13. This time however, the event #1 should be Consent Default and the Consent tab in the event's Output pane should show a table with all the values in the On-page Default column should be Denied Screenshot 2024-09-20 at 15 40 57
  14. The Consent Initialization should now be event #2 and it's Content tab should show the same table, but with an additional Current State column also with all values Denied Screenshot 2024-09-20 at 15 43 08
  15. Now in the browser tab with http://localhost:3000/exportwins/review/<token> open, click on the Accept analytics cookies button in the cookie banner on top of the page
  16. A Consent update event should appear in [Google Tag Assistant] and the table with it's Consent tab should now have the value Granted in the On-page Update column of row analytics_storage only Screenshot 2024-09-20 at 15 47 07
  17. Repeat steps 11 and 12
  18. As in step 14, the event #1 should be Consent Default, but now the table in the Consent tab should have the value Granted in the On-page Update column of row analytics_storage only Screenshot 2024-09-20 at 15 56 02
  19. The whole procedure fro step 11 should be repeated once more but instead of clicking the Accept analytics cookies in step 16, you should click on the Reject analytics cookies button
  20. In all the remaining steps all values in the Consent table should be Denied

[Google Tag Assistant]: https://tagassistant.google.com "Google Tag Assistant" Consent tab should show a similar table where also the

so that Export Wins Review and the rest of Data Hub have
their own gtag initialization.
@peterhudec peterhudec requested a review from a team as a code owner September 20, 2024 14:58
Copy link

cypress bot commented Sep 20, 2024

data-hub-frontend    Run #55981

Run Properties:  status check passed Passed #55981  •  git commit 8fe5802664: Reorganize Google Tag Manager snipped and initialization
Project data-hub-frontend
Branch Review fix/google-tag-manager
Run status status check passed Passed #55981
Run duration 01m 37s
Commit git commit 8fe5802664: Reorganize Google Tag Manager snipped and initialization
Committer Peter Hudec
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 15
View all changes introduced in this branch ↗︎

@peterhudec peterhudec merged commit 48f6cd1 into main Sep 23, 2024
14 checks passed
@peterhudec peterhudec deleted the fix/google-tag-manager branch September 23, 2024 10:21
chopkinsmade pushed a commit that referenced this pull request Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants