Skip to content

Add Google Tag Manager and OneTrust to relevant checkout pages

What does this MR do and why?

We've got instructions to add Google Tag Manager to the checkout flow. The terms view and new subscriptions view are both currently missing the necessary tags to provide coverage.

I've also added OneTrust to each view to allow users to appropriately manage their cookie settings across these pages.

As far as I can tell, once this is merged and the gtm_nonce feature flag is rolled out, we'll have Checkout flow instrumented. Feature flag rollout: #346322 (closed)

In the case of the terms page, I added GTM/OneTrust to the layout itself, rather than the partial view at app/views/users/terms/index.html.haml, since I wanted to make sure that the GTM body code was added at the opening body tag, and I don't think the terms layout affects any other view. In the case of the subscriptions view, I figured it made sense to stick with the pattern of adding the code to the more specific partial.

I can easily move the GTM and OneTrust code back to app/views/users/terms/index.html.haml if that's preferable.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

I don't think there are relevant screenshots or recordings to take here, but if folks have questions that could be answered that way, I'm happy to figure it out.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Similar to the steps in !58494 (merged),

  1. Go to Google Tag Manager and create new container. Grab your ID there.
  2. Edit your config/gitlab.yml and add under extra: values for google_tag_manager_nonce_id and google_tag_manager_id that should be your GTM id from previous step.
  3. Restart GDK
  4. Enable the feature flag with Feature.enable(:gtm_nonce) via Rails console.
  5. Sign out from your local GDK instance.
  6. Open the Tag Assistant and follow instructions there on enabling debugging support on your localhost.
  7. Verify GTM is working across the terms and subscription pages.

I couldn't actually access localhost:3000/-/users/terms or localhost:3000/-/subscriptions/new to validate this. Normally I would spend time trying to understand what all is going on there before making an MR, but we're on an extremely tight turnaround. This needs to be merged in by Thursday, 2021-12-02.

Due to that tight timeline, and since I think adding these partials is already well supported and tested, I'm hoping we can review this quickly and merge it in.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tyler Williams

Merge request reports