Skip to content

Commit

Permalink
add google analytics data
Browse files Browse the repository at this point in the history
  • Loading branch information
lejenome committed Jun 26, 2017
1 parent ccff3f8 commit 40f063e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"VP",
"chgPref",
"unsafeWindow",
"dump"
"dump",
"fetch"
]
}
23 changes: 23 additions & 0 deletions data/report-geolocation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict";
function reportGeolocation() {
let data = "";
data = data.concat("v", "=" , encodeURIComponent(1));
data = data.concat("&", "tid", "=" , encodeURIComponent("UA-28759938-4"));
data = data.concat("&", "cid", "=" , encodeURIComponent(OPTIONS.uuid));
data = data.concat("&", "t", "=" , encodeURIComponent("event")); // pageview
data = data.concat("&", "ec", "=" , encodeURIComponent("content-page"));
data = data.concat("&", "ea", "=" , encodeURIComponent("inject"));
data = data.concat("&", "dh", "=" , encodeURIComponent("localhost"));
data = data.concat("&", "dp", "=" , encodeURIComponent("/html5-video-everywhere"));
data = data.concat("&", "ds", "=" , encodeURIComponent("app"));
data = data.concat("&", "an", "=" , encodeURIComponent("HTML5 Video EveryWhere"));
data = data.concat("&", "aid", "=" , encodeURIComponent("html5-video-everywhere@lejenome.me"));
data = data.concat("&", "av", "=" , encodeURIComponent("0.3.5"));
data = data.concat("&", "ul", "=" , encodeURIComponent(navigator.language));

fetch("https://www.google-analytics.com/collect", {
method: "POST",
body: data,
});
}
onReady(reportGeolocation);
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const drivers = Object.keys(allDrivers).filter(drvName =>
const onWorkerAttach = (drvName, listen) => (worker) => {
logify("onAttach", worker);
//send current Addon preferences to content-script
if (!prefs.uuid) {
prefs.uuid = require("sdk/util/uuid").uuid().toString().substr(1, 36);
}
let _prefs = {};
for (let pref in prefs)
_prefs[pref] = prefs[pref];
Expand Down
3 changes: 2 additions & 1 deletion lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let inject = [],
style = [];
inject = inject.concat([
"common.js",
"report-geolocation.js",
"video-player.js"
]);
/*
Expand All @@ -19,4 +20,4 @@ if (prefs.player === 1) {
exports.type = "site";
exports.name = "common";
exports.inject = inject;
exports.style = style;
exports.style = style;
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "HTML5 Video Everywhere!",
"name": "html5-video-everywhere",
"id": "html5-video-everywhere@lejenome.me",
"version": "0.3.4",
"version": "0.3.5",
"description": "Replace video player with Firefox native video player",
"main": "index.js",
"author": "Moez Bouhlel <bmoez.j@gmail.com> (http://lejenome.github.io/)",
Expand Down Expand Up @@ -307,6 +307,12 @@
"description": "Use default video player on Youtube",
"type": "bool",
"value": false
},
{
"name": "uuid",
"title": "Firefox Session Unique Identifier",
"type": "string",
"hidden": true
}
]
}

0 comments on commit 40f063e

Please sign in to comment.