GTM + GA4 Fix with for a downloadable resource type
Бюджэт: -
HOURLY / PART_TIME
⭐ 4.98 (12)
United States
google-tag-manager, bigquery, data-science, google-adwords, pixel-setup-and-optimization, web-analytics, lead-generation, conversion-rate-optimization, marketing-api-integration
Preferred qualifications
- Experience: Intermediate
What We're Trying to Do
Track two types of PDF downloads in GA4
- Threat Reports
- Case Studies
The goal is to see a clean file_type dimension in GA4 that reports threat_report or case_study for each download, without having to manually update tracking for new report pdfs that are uploaded.
Each report will have a resource_type attribute assigned via Elementor to help this scale without needing to rebuild when we add new downloadable resources.
Where We're Stuck
- The GTM tag does not fire when clicking the Case Study download button.
- The Threat Report button works inconsistently, but the Case Study button is completely silent.
- The Resource Type variable, which should read data-resource-type="case_study" from the button, is not working, causing the trigger to fail.
Avenues We've Tried
-Enhanced Measurement: Initially tried using GA4's automatic file download tracking, but it was unreliable and didn't distinguish content types cleanly.
- GTM Click URL Trigger: Built a GTM trigger based on the Click URL matching regex patterns. This failed because the trigger condition was not met.
- GTM Data Attribute Variable: Built a custom JavaScript variable (Resource Type) to read the data-resource-type attribute from the button and a trigger to fire when that variable is not undefined. The variable is failing to return a value for the Case Study button, so the tag never fires.
Likely Root Cause
The download buttons are built in Elementor. The user clicks on a span inside the a tag. Our Resource Type variable needs to be robust enough to "walk up" the DOM from the clicked span to find the parent a tag and read its data-resource-type attribute. The current JavaScript variable is failing to do this, causing the trigger to fail and the tag to not fire. We can look at this together with the help of a developer if we can't find a work-around.
What Needs to Be Done
Either find another scalable way to build this tracking system, or... the following:
1. Debug the Resource Type Variable:
We can inspect inspect the GTM JavaScript variable to ensure it correctly finds the parent a tag and returns the data-resource-type value for any click inside the button.
2. Verify HTML Attributes:
Confirm the data-resource-type="case_study" attribute exists on the correct a tag for the Case Study button.
3. Test and Validate:
Once the variable is fixed, test both buttons in GTM Preview to ensure the tag fires and the file_type parameter is sent correctly to GA4.
Finalize Setup: Publish the container and turn off GA4 Enhanced Measurement for file downloads to prevent duplicate data.
Адкрыць заказ
AI-чарнавік адказу
Згенеруйце кароткі cover letter па гэтай вакансіі. Перад адпраўкай адрэдагуйце.
Увайдзіце, каб згенерыраваць AI-чарнавік.
Увайсці