Skip to content

Commit 26cc2fc

Browse files
committed
Bug 1862768: move mac attribution cache to a new file r=nalexander
While investigating why initial macOS attribution data had a lower attribution rate than expected I realized that one reason why this may be the case is because we're using the same file as a cache for it. This means that even if a user has paved over with a fresh install, we will pick up the previous attribution data (even if it was null). While doing this, I think we should also accommodate having separate attribution data per channel, which should keep the data cleaner. Release, Beta, and ESR use `Firefox.app`, which makes the likelyhood of a paveover with a different channel reasonably high. Differential Revision: https://phabricator.services.mozilla.com/D192628
1 parent 67970b0 commit 26cc2fc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

browser/components/attribution/AttributionCode.sys.mjs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const lazy = {};
1717
ChromeUtils.defineESModuleGetters(lazy, {
1818
MacAttribution: "resource:///modules/MacAttribution.sys.mjs",
1919
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
20+
UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
2021
});
2122
ChromeUtils.defineLazyGetter(lazy, "log", () => {
2223
let { ConsoleAPI } = ChromeUtils.importESModule(
@@ -107,7 +108,21 @@ export var AttributionCode = {
107108
throw ex;
108109
}
109110
}
110-
file.append("macAttributionData");
111+
// Note: this file is in a location that includes the absolute path
112+
// to the running install, and the filename includes the update channel.
113+
// To ensure consistency regardless of when `attributionFile` is accessed we
114+
// explicitly do not include partner IDs that may be part of the full update channel.
115+
// These are not necessarily applied when this is first accessed, and we want to
116+
// ensure consistency between early and late accesses.
117+
// Partner builds never contain attribution information, so this has no known
118+
// consequences.
119+
// For example:
120+
// ~/Library/Caches/Mozilla/updates/Applications/Firefox/macAttributionDataCache-release
121+
// This is done to ensure that attribution data is preserved through a
122+
// pave over install of an install on the same channel.
123+
file.append(
124+
"macAttributionDataCache-" + lazy.UpdateUtils.getUpdateChannel(false)
125+
);
111126
return file;
112127
}
113128

0 commit comments

Comments
 (0)