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

Identify partner builds as "release" channel in analytics #15930

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions media/js/base/datalayer-productdownload.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,28 @@ TrackProductDownload.getEventFromUrl = (downloadURL) => {
stageURL.test(downloadURL) ||
devURL.test(downloadURL)
) {
// expect the link to have parameters like: ?product=firefox-beta-latest-ssl&os=osx&lang=en-US
// extract the values we need from the parameters
const productParam = params.product;
const productSplit = productParam.split('-');

// product is first word of product param
let product = productSplit[0];
// partner builds are labelled as ?product=partner-firefox so class these as regular 'firefox' download events.
// (except partner builds are labelled as ?product=partner-firefox so class these as regular 'firefox' download events)
product = product === 'partner' ? 'firefox' : product;

// platform is `os` param
let platform = params.os;
// change platform to macos if it's osx
platform = platform === 'osx' ? 'macos' : platform;
// append 'msi' to platform if msi is in the product parameter
platform =
productParam.indexOf('msi') !== -1 ? platform + '-msi' : platform;
// release channel is second word of product param

// release channel uses second word of product param
let release = productSplit[1];
// (except partner builds - where 'partner' is the first word)
release = productSplit[0] === 'partner' ? 'release' : release;
// (except for latest, msi, or sub installer - we update those to say release)
if (release === 'latest' || release === 'stub' || release === 'msi') {
release = 'release';
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/spec/base/datalayer-productdownload.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ describe('TrackProductDownload.getEventFromUrl', function () {
);
expect(testEvent['release_channel']).toBe('release');
});
it('should identify release_channel for Firefox partner builds', function () {
const testEvent = TrackProductDownload.getEventFromUrl(
'https://bouncer-bouncer.stage.mozaws.net/?product=partner-firefox-release-smi-smi-001-latest&os=osx&lang=en-GB&_gl=1&234*_ga*ABC'
);
expect(testEvent['release_channel']).toBe('release');
});
it('should identify release_channel for Firefox Beta', function () {
const testEvent = TrackProductDownload.getEventFromUrl(
'https://download.mozilla.org/?product=firefox-beta-latest-ssl&os=osx&lang=en-US'
Expand Down
Loading