Fix GTM tracking on the mozilla.org homepage

RESOLVED FIXED

Status

www.mozilla.org
Pages & Content
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: agibson, Assigned: agibson)

Tracking

Production

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [kb=1836758] )

Attachments

(2 attachments)

(Assignee)

Description

3 years ago
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
(Assignee)

Updated

3 years ago
Blocks: 1188941
(Assignee)

Updated

3 years ago
Whiteboard: [kb=1811359]
(Assignee)

Updated

3 years ago
Whiteboard: [kb=1811359]
Whiteboard: [kb=1816990]
(Assignee)

Comment 1

3 years ago
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&amp;utm_source=mozilla.org&amp;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 :/
(Assignee)

Updated

3 years ago
Summary: Clean up GTM tracking on the mozilla.org homepage → Fix GTM tracking on the mozilla.org homepage
(Assignee)

Updated

3 years ago
Whiteboard: [kb=1816990] → [kb=1836758]
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.
(Assignee)

Comment 3

3 years ago
(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)

Updated

3 years ago
Assignee: nobody → agibson
Status: NEW → ASSIGNED
(Assignee)

Comment 4

3 years ago
Created attachment 8655457 [details] [review]
GitHub pull request
(Assignee)

Comment 5

3 years ago
Will push this to a demo for testing shortly.
(Assignee)

Comment 6

3 years ago
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!
(Assignee)

Updated

3 years ago
Flags: needinfo?(garethcull.bugs)
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
Flags: needinfo?(garethcull.bugs)

Comment 8

3 years ago
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

Updated

3 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
(Assignee)

Comment 9

3 years ago
Reopening this as I notice the tracking for the main link navigation is incorrect too.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 10

3 years ago
Created attachment 8658138 [details] [review]
GitHub pull request

Comment 11

3 years ago
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

Updated

3 years ago
Status: REOPENED → RESOLVED
Last Resolved: 3 years ago3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.