Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Send GA ping on browser startup
- Loading branch information
Showing
with
33 additions
and
5 deletions.
-
+2
−0
index.js
-
+30
−4
lib/ga-utils.js
-
+1
−1
package.json
|
|
@@ -51,6 +51,8 @@ exports.main = function() { |
|
|
|
|
|
setUpTestEnv(); |
|
|
|
|
|
gaUtils.sendStartupGAPing(); |
|
|
|
|
|
// if destroyAddon is true |
|
|
if (detroyAddon) { |
|
|
// destroy the pageMod as the tour is complete. |
|
|
|
|
|
@@ -6,6 +6,10 @@ let timers = require('sdk/timers'); |
|
|
let { storageManager } = require('./storage-manager.js'); |
|
|
let { variations } = require('./variations.js'); |
|
|
|
|
|
const clientId = '35009a79-1a05-49d7-b876-2b884d0f825b'; |
|
|
const hitType = 'event'; |
|
|
const trackingId = 'UA-36116321-22'; |
|
|
|
|
|
exports.gaUtils = { |
|
|
/** |
|
|
* Gathers and returns data for the current event |
|
|
@@ -48,18 +52,18 @@ exports.gaUtils = { |
|
|
url: 'https://www.google-analytics.com/collect', |
|
|
content: { |
|
|
v: 1, |
|
|
t: 'event', |
|
|
t: hitType, |
|
|
ec: 'Addon Interactions', |
|
|
ea: eventData.step, |
|
|
el: label, |
|
|
cid: '35009a79-1a05-49d7-b876-2b884d0f825b', |
|
|
cid: clientId, |
|
|
cd3: eventData.contentVariation, |
|
|
cd4: eventData.topic, |
|
|
cd5: module.exports.gaUtils.impressionCount(), |
|
|
tid: 'UA-36116321-22' |
|
|
tid: trackingId |
|
|
}, |
|
|
onComplete: function(response) { |
|
|
console.error('Response from GA', response.status); |
|
|
console.error('Response for post from GA', response.status); |
|
|
} |
|
|
}); |
|
|
|
|
|
@@ -68,5 +72,27 @@ exports.gaUtils = { |
|
|
timers.setTimeout(function() { |
|
|
gaRequest.post(); |
|
|
}, 5000); |
|
|
}, |
|
|
/** |
|
|
* Send a ping to GA on each startup of the browser |
|
|
*/ |
|
|
sendStartupGAPing: function() { |
|
|
let gaRequest = Request({ |
|
|
url: 'https://www.google-analytics.com/collect', |
|
|
content: { |
|
|
v: 1, |
|
|
t: hitType, |
|
|
ec: 'Firefox Interactions', |
|
|
ea: 'Start Browser', |
|
|
cid: clientId, |
|
|
cd3: storageManager.get('variation'), |
|
|
tid: trackingId |
|
|
}, |
|
|
onComplete: function(response) { |
|
|
console.error('Response for sendStartupGAPing from GA', response.status); |
|
|
} |
|
|
}); |
|
|
|
|
|
gaRequest.post(); |
|
|
} |
|
|
}; |
|
|
@@ -1,7 +1,7 @@ |
|
|
{ |
|
|
"title": "Firefox OnBoard", |
|
|
"name": "onboard-v1", |
|
|
"version": "1.0.4", |
|
|
"version": "1.0.5", |
|
|
"description": "The Mozilla Firefox Onboarding Experiment", |
|
|
"homepage": "https://github.com/mozilla/onaboard", |
|
|
"repository": "https://github.com/mozilla/onaboard", |
|
|
|