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

Debug GTM VirtualPageView events, add collections data to /collections/* routes. #295

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

mathewjordan
Copy link
Member

@mathewjordan mathewjordan commented Sep 11, 2023

What does this do?

In the end, this doesn't do too much, but does:

  1. add the previously omitted title to a /collections/* route dataLayer payload.
  2. add basic defensiveness around the dataLayer.push, checking for a page title
  3. breaks up the dataLayer.push into two steps so that the event for only comes after data has been defined

Steps 2 and 3 will be watched over the next few days to test their effect.

@mathewjordan mathewjordan marked this pull request as draft September 11, 2023 20:36
@mathewjordan mathewjordan changed the title Add title to Collections data layer. Debug GTM VirtualPageView events, add collections data to /collections/* routes. Sep 13, 2023
@mathewjordan mathewjordan self-assigned this Sep 13, 2023
@mathewjordan mathewjordan marked this pull request as ready for review September 13, 2023 12:03
// @ts-ignore
window.dataLayer?.push(payload);
if (dataLayer?.pageTitle) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably makes sense, since we'll likely never have a page (Collection, Work, About, etc) without a Title in production? Or is this a possibility? @davidschober ?

@mathewjordan mathewjordan merged commit d7f3ee9 into deploy/staging Sep 13, 2023
@mathewjordan mathewjordan deleted the 4165-collection-gtm branch September 13, 2023 14:36
@mathewjordan mathewjordan restored the 4165-collection-gtm branch September 13, 2023 14:39
@mathewjordan mathewjordan deleted the 4165-collection-gtm branch September 13, 2023 16:59
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.

2 participants