Description
In this PR, we've implemented everything needed to support a new Google Tag Manager container on our website. This container is intended to track all purchases made using the welcome coupon code, specifically for the company AddShoppers.While this could technically be done via Stripe, we've chosen this approach to test a campaign in which they also want to track clicks and other interactions.It's essentially a first step to see if a long-term collaboration with them is viable.
Changes:
We've added a new script to the index file to send data to the new container.
Although there's no issue with the G-XXXX key being visible, we can move it to an environment variable if you think it's better.
We now also want to store the email address of the user who makes the purchase, as it's one of the required values. So we save it and later store it in localStorage.
We've updated the file that sends the data, along with its test, to match what we need for the container.
Related Issues
Related Pull Requests
Checklist
- Changes have been tested locally.
- Unit tests have been written or updated as necessary.
- The code adheres to the repository's coding standards.
- Relevant documentation has been added or updated.
- No new warnings or errors have been introduced.
- SonarCloud issues have been reviewed and addressed.
- QA Passed
Testing Process
During the testing process, here’s what we’ve done in the container: we defined two tags — a global one used for activation and data sending, and a conversion tag.
The first tag (the global one) can be tested and confirmed as active by adding the Vercel URL into a built-in tool within the container. It confirms that the tag is firing correctly, thanks to the script ending in G-XXXX.
The second tag is configured to fire when a user completes a purchase (i.e., when the URL contains /checkout/success).
This one couldn’t be tested via Vercel since the domain switches to drive.internxt... upon completing a real purchase. However, we simulated the condition by manually adding something like /checkout/success... to the Vercel URL, and confirmed that it does indeed activate as expected.
Additional Notes
Working on confluence documentation