Bug 1677497 - Add support for the attribution parameter: dltoken r=nalexander,Mardak
authorKirk Steuber <ksteuber@mozilla.com>
Wed, 20 Jan 2021 01:08:43 +0000
changeset 564172 e84aa5bced3c6cfd9b612ebc8cdaae2ac253e0e9
parent 564171 6d054679d432dc2258f2a876e51d3d5003706cee
child 564173 10183e73c231cb0e72e8a047f8d63913725e3705
push id38130
push userbtara@mozilla.com
push dateFri, 22 Jan 2021 04:37:37 +0000
treeherdermozilla-central@a6b9acc070e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander, Mardak
bugs1677497
milestone86.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1677497 - Add support for the attribution parameter: dltoken r=nalexander,Mardak Differential Revision: https://phabricator.services.mozilla.com/D100969
browser/components/attribution/AttributionCode.jsm
browser/components/attribution/test/xpcshell/head.js
browser/components/newtab/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx
toolkit/components/telemetry/docs/data/environment.rst
--- a/browser/components/attribution/AttributionCode.jsm
+++ b/browser/components/attribution/AttributionCode.jsm
@@ -45,16 +45,17 @@ const ATTR_CODE_KEY_VALUE_SEPARATOR = "%
 const ATTR_CODE_KEYS = [
   "source",
   "medium",
   "campaign",
   "content",
   "experiment",
   "variation",
   "ua",
+  "dltoken",
 ];
 
 let gCachedAttrData = null;
 
 var AttributionCode = {
   /**
    * Returns a platform-specific nsIFile for the file containing the attribution
    * data, or null if the current platform does not support (caching)
--- a/browser/components/attribution/test/xpcshell/head.js
+++ b/browser/components/attribution/test/xpcshell/head.js
@@ -43,16 +43,20 @@ let validAttrCodes = [
     code: "experiment%3Dexperimental",
     parsed: { experiment: "experimental" },
   },
   { code: "variation%3Dvaried", parsed: { variation: "varied" } },
   {
     code: "ua%3DGoogle%20Chrome%20123",
     parsed: { ua: "Google%20Chrome%20123" },
   },
+  {
+    code: "dltoken%3Dc18f86a3-f228-4d98-91bb-f90135c0aa9c",
+    parsed: { dltoken: "c18f86a3-f228-4d98-91bb-f90135c0aa9c" },
+  },
 ];
 
 let invalidAttrCodes = [
   // Empty string
   "",
   // Not escaped
   "source=google.com&medium=organic&campaign=(not set)&content=(not set)",
   // Too long
--- a/browser/components/newtab/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx
+++ b/browser/components/newtab/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx
@@ -522,16 +522,17 @@ export class ASRouterAdminInner extends 
       attributionParameters: {
         source: "addons.mozilla.org",
         medium: "referral",
         campaign: "non-fx-button",
         content: "iridium@particlecore.github.io",
         experiment: "ua-onboarding",
         variation: "chrome",
         ua: "Google Chrome 123",
+        dltoken: "00000000-0000-0000-0000-000000000000",
       },
     };
   }
 
   onMessageFromParent({ type, data }) {
     // These only exists due to onPrefChange events in ASRouter
     switch (type) {
       case "UpdateAdminState": {
@@ -1562,16 +1563,31 @@ export class ASRouterAdminInner extends 
                 placeholder="Google Chrome 123"
                 value={this.state.attributionParameters.ua}
                 onChange={this.onChangeAttributionParameters}
               />{" "}
             </td>
           </tr>
           <tr>
             <td>
+              <b> Download Token </b>
+            </td>
+            <td>
+              {" "}
+              <input
+                type="text"
+                name="dltoken"
+                placeholder="00000000-0000-0000-0000-000000000000"
+                value={this.state.attributionParameters.dltoken}
+                onChange={this.onChangeAttributionParameters}
+              />{" "}
+            </td>
+          </tr>
+          <tr>
+            <td>
               {" "}
               <button
                 className="ASRouterButton primary button"
                 onClick={this.setAttribution}
               >
                 {" "}
                 Force Attribution{" "}
               </button>{" "}
--- a/toolkit/components/telemetry/docs/data/environment.rst
+++ b/toolkit/components/telemetry/docs/data/environment.rst
@@ -78,16 +78,17 @@ Structure:
           // all of these values are optional.
           source: <string>, // referring partner domain, when install happens via a known partner
           medium: <string>, // category of the source, such as "organic" for a search engine
           campaign: <string>, // identifier of the particular campaign that led to the download of the product
           content: <string>, // identifier to indicate the particular link within a campaign
           variation: <string>, // name/id of the variation cohort used in the enrolled funnel experiment
           experiment: <string>, // name/id of the enrolled funnel experiment
           ua: <string>, // identifier derived from the user agent downloading the installer, e.g., chrome, Google Chrome 123
+          dltoken: <string>, // Unique token created at Firefox download time. ex: c18f86a3-f228-4d98-91bb-f90135c0aa9c
         },
         sandbox: {
           effectiveContentProcessLevel: <integer>,
         }
       },
       // Optional, missing if fetching the information failed or had not yet completed.
       services: {
         // True if the user has a firefox account