There's a bunch of GTM related JS on the homepage that adds data-attributes to the page content for tracking purposes. Most of this could probably exist right in the template, and does not need to be added to the DOM using JS. Currently we're just touching the DOM a bunch of times on page load when we don't really need to. https://github.com/mozilla/bedrock/blob/master/media/js/mozorg/home/ga-tracking.js
I was just reviewing some home page promo changes and noticed the JS linked above doesn't work correctly. It's creating incorrect data-attributes on the home page promos, giving incorrect data: <li id="promo-11" class="item promo-large-landscape mdn-10-years" tabindex="0" data-name="Mozilla Developer Network"> <h2 class="primary go">Mozilla Developer Network</h2> <a data-promotion-type="tile" data-promotion-class="promo-large-portrait" data-promotion-name="Put your Firefox on your Android" data-promotion-id="promo-1" class="panel-link" href="https://developer.mozilla.org/docs/mdn_at_ten?utm_campaign=mdn10&utm_source=mozilla.org&utm_medium=home-tile"> <div class="secondary"> <h3>10 years of documenting your Web.</h3> <p class="more">Celebrate with us</p> </div> </a> </li> Notice how this MDN promo has the following data attributes: data-promotion-name="Put your Firefox on your Android" data-promotion-id="promo-1" This is being incorrectly applied for pretty much all of the promos, giving us incorrect GA data since GTM went live :/
Summary: Clean up GTM tracking on the mozilla.org homepage → Fix GTM tracking on the mozilla.org homepage
Thanks for finding this Alex. I'm going to flag this with AP and let them know about the issue since we are currently reviewing our event hierarchy and updating our nomenclature.
(In reply to Gareth Cull [:garethc] from comment #2) > Thanks for finding this Alex. I'm going to flag this with AP and let them > know about the issue since we are currently reviewing our event hierarchy > and updating our nomenclature. I'm going to actively fix this bug in master and remove their JS code. Most of this can be done directly in the template file (probably a good thing here as there is less disconnect for mistakes like this to occur). I can push to a demo for review before we merge.
Assignee: nobody → agibson
Status: NEW → ASSIGNED
Will push this to a demo for testing shortly.
Hi Gareth, I've pushed this change to demo2 - hopefully the tiles should all have the correct data attributes associated with them now. Can you please take a look and let me know if all looks ok? https://www-demo2.allizom.org/en-US/ Thanks!
Hey Alex, I just checked and it looks like all of the tiles are passing the right information to GA on click of each tile. Thanks for the fix! Gareth
Commits pushed to master at https://github.com/mozilla/bedrock https://github.com/mozilla/bedrock/commit/94187963c793dc745d2aa5ec2eaa52d92abbaa4c [fix bug 1188943] Fix GTM tracking on the mozilla.org homepage https://github.com/mozilla/bedrock/commit/243cdfd1447265da1fca6d05490d8602bde8a0ff Merge pull request #3268 from alexgibson/bug-1188943-fix-gtm-tracking-mozilla-homepage [fix bug 1188943] Fix GTM tracking on the mozilla.org homepage
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Reopening this as I notice the tracking for the main link navigation is incorrect too.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Commits pushed to master at https://github.com/mozilla/bedrock https://github.com/mozilla/bedrock/commit/d85475ac9bf47a6b60d6e9227ef84b44f8831de5 [fix bug 1188943] Fix GTM nav link tracking on homepage https://github.com/mozilla/bedrock/commit/a17313d05d88a847a67a47890dbbd1d841ed2111 Merge pull request #3287 from alexgibson/bug-1188943-fix-homepage-tracking [fix bug 1188943] Fix GTM nav link tracking on homepage
Status: REOPENED → RESOLVED
Last Resolved: 3 years ago → 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.