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

Trigger TrackProductDownload for all mobile and desktop downloads #13416

Merged
merged 9 commits into from
Sep 15, 2023

Conversation

stephaniehobson
Copy link
Contributor

@stephaniehobson stephaniehobson commented Jul 17, 2023

One-line summary

Add Adjust support to TrackProductDownload and trigger on all remaining desktop downloads (previously this had just been triggered on /all).

Significant changes and points to review

  • add method and link_url parameters to product_download event
    • update tests
  • stop assuming product is firefox and log it if the product is unrecognized
    • update tests
  • add support for App Store links in addition to iTunes links
  • add logic to support Adjust links
    • and identify which product and app store adjust links are for
  • add TrackProductDownload to all pages on the site and init it
    • listen to links with class ga-product-download on all pages
    • remove what is now duplicate listener from /all
  • add class ga-product-download to adjust links and download buttons

Issue / Bugzilla link

#13238

Testing

Successful integration tests

  • Referrals to the app or play stores should trigger before leaving the site
  • Buttons/links/dropdowns that refer to /thanks should only trigger on /thanks
  • Buttons/links/dropdowns that link directly to bouncer should trigger an event when clicked

This branch is up on demo4 for testing with https://tagassistant.google.com/

https://www-demo4.allizom.org/en-US/firefox/new/ (and click download)
https://www-demo4.allizom.org/en-US/firefox/download/thanks/?s=direct
https://www-demo4.allizom.org/en-US/firefox/
https://www-demo4.allizom.org/en-US/firefox/browsers/
https://www-demo4.allizom.org/en-US/firefox/browsers/
https://www-demo4.allizom.org/en-US/firefox/browsers/mobile/
https://www-demo4.allizom.org/en-US/firefox/browsers/mobile/ios
https://www-demo4.allizom.org/en-US/firefox/browsers/mobile/android
https://www-demo4.allizom.org/en-US/firefox/browsers/mobile/focus
https://www-demo4.allizom.org/en-US/firefox/developer/
https://www-demo4.allizom.org/en-US/firefox/channel/desktop/

@stephaniehobson stephaniehobson changed the title Add Adjust support to TrackProductDownload Update TrackProductDownload for Adjust and /thanks pages Aug 17, 2023
@stephaniehobson stephaniehobson changed the title Update TrackProductDownload for Adjust and /thanks pages Trigger TrackProductDownload for all mobile and desktop downloads Aug 17, 2023
@stephaniehobson stephaniehobson added P1 First level priority - Must have Needs Review Awaiting code review Review: M Code review time: 1-2 hours Analytics 📈 labels Aug 17, 2023
@stephaniehobson
Copy link
Contributor Author

This is ready for review but is toooooo scary to merge before All Hands.

@stephaniehobson
Copy link
Contributor Author

@alexgibson Do you have time to take another look at this?

Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

I went through and tested a bunch of pages locally and everything seems to work well, and nice job on the tests!

I did have a few questions along the way, and I'm not sure if those are really issues or just things I thought I should flag / question.

The one thing I couldn't do is test with tagassistant, which for some reason refuses to connect on any demo server for me :/

media/js/base/datalayer-productdownload.es6.js Outdated Show resolved Hide resolved
media/js/base/datalayer-productdownload.es6.js Outdated Show resolved Hide resolved
media/js/base/datalayer-productdownload.es6.js Outdated Show resolved Hide resolved
@stephaniehobson stephaniehobson marked this pull request as draft September 5, 2023 21:54
@stephaniehobson
Copy link
Contributor Author

Converting this back to a draft and exploring a different way of doing this.

@stephaniehobson
Copy link
Contributor Author

@alexgibson I made ALL THE UPDATES.

@stephaniehobson stephaniehobson marked this pull request as ready for review September 13, 2023 22:09
@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (ac82b6b) 76.65% compared to head (4d77bf4) 76.66%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13416   +/-   ##
=======================================
  Coverage   76.65%   76.66%           
=======================================
  Files         147      147           
  Lines        7878     7881    +3     
=======================================
+ Hits         6039     6042    +3     
  Misses       1839     1839           
Files Changed Coverage Δ
bedrock/mozorg/templatetags/misc.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

Updates are looking good! I made a couple of comments below. I do wonder if we should apply the query params to the mobile app store links as well? (seems easier to read?)

One other thing that occurred to me is that not all of our adjust links seem to be using the adjust helpers :/

Perhaps if we're to move forward with this approach then we need to make sure we're adding the params to the manual links as well? It's also not 100% clear to me why we stopped using the helpers (perhaps worth asking Dan about?)

productSplit[1] === 'latest' ? 'release' : productSplit[1];
let releaseChannel = productSplit[1];
// (except for latest, msi, or sub installer - we update those to say release)
if (['latest', 'stub', 'msi'].includes(releaseChannel)) {
Copy link
Member

Choose a reason for hiding this comment

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

This might throw an error in IE (haven't tested, but checked https://caniuse.com/array-includes)

} else if (appStoreURL.test(downloadURL)) {
} else if (appStoreURL.test(downloadURL) || iTunesURL.test(downloadURL)) {
let iosProduct = 'unrecognized';
if (downloadURL.indexOf('/id989804926') !== -1) {
Copy link
Member

Choose a reason for hiding this comment

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

Agree it might be worth applying the same params we use on adjust links to make this a bit clearer to read?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

10 minutes of exploration tells me this could be complicated because the store links are often included in the adjust links. Can I add this to my list of future improvements and merge this as is? (once I fix the IE compatibility problem)

Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

r+

@stephaniehobson stephaniehobson merged commit 1a18ca5 into main Sep 15, 2023
5 checks passed
@stephaniehobson stephaniehobson deleted the pd_adjust branch September 15, 2023 15:31
@stephaniehobson stephaniehobson removed the Needs Review Awaiting code review label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Analytics 📈 P1 First level priority - Must have Review: M Code review time: 1-2 hours
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants