feat: attribute book buy-clicks to the on-page CTA - #435
Open
dwmkerr wants to merge 1 commit into
Open
Conversation
Add a data-book-cta attribute to every Amazon / No Starch link (chapter lead banner, chapter footer, homepage hero and nav). GTM reads it into a link_location event parameter on the amazon_click and nostarch_click events, surfaced in GA4 as the 'Book CTA location' custom dimension, so buy-clicks can be split by where on the page they came from. Menubar links are matched by their existing header-* class, so the navbar config is untouched. Document the setup in the README.
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
data-book-ctaattribute to every Amazon / No Starch link (chapter lead banner, chapter footer, homepage hero and nav) so book buy-clicks can be attributed to which on-page CTA they came from.GTM-WS7KMPTS) reads it into alink_locationparameter on theamazon_click/nostarch_clickevents, surfaced in GA4 as the event-scoped custom dimension Book CTA location. Toolbar and site-footer links are matched by class / container instead (they're config-driven and can't take the attribute), so no navbar/footer config change is needed.Attribution is forward-only (GA4 can't backfill) and a missing attribute never breaks tracking — the click still fires, it just reports
(unmarked). The GTM container and GA4 custom dimension are already live.