Skip to content

Commit

Permalink
v1.10 release for GA v2 (#85)
Browse files Browse the repository at this point in the history
* Bump lodash from 4.17.11 to 4.17.14 (#84)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.14.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.11...4.17.14)

Signed-off-by: dependabot[bot] <support@github.com>

* Initial App+Web update for GA

* Prep 1.10
  • Loading branch information
MisterPhilip committed Aug 7, 2019
1 parent 95ad569 commit 9c22dc1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function(grunt) {
},
"production": {
"name": "Omnibug",
"version": "1.9.0",
"version": "1.10.0",
"storageKey": "omnibug",
"feedbackUrl": "https://omnibug.io/feedback",
"analyticsID": "UA-114343677-2"
Expand Down Expand Up @@ -516,4 +516,4 @@ module.exports = function(grunt) {
grunt.registerTask("build", ["build-production"]);
grunt.registerTask("production", ["build-production"]);
grunt.registerTask("beta", ["build-beta"]);
};
};
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "omnibug",
"version": "1.9.0",
"version": "1.10.0",
"description": "Omnibug Extension",
"main": "Gruntfile.js",
"scripts": {
Expand Down
14 changes: 10 additions & 4 deletions src/providers/UniversalAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class UniversalAnalyticsProvider extends BaseProvider
{
super();
this._key = "UNIVERSALANALYTICS";
this._pattern = /\.google-analytics\.com\/(r\/)?collect(?:[\/?]+|$)/;
this._pattern = /\.google-analytics\.com\/([rg]\/)?collect(?:[\/?]+|$)/;
this._name = "Universal Analytics";
this._type = "analytics";
this._keywords = ["google", "google analytics", "ua", "ga"];
Expand Down Expand Up @@ -185,6 +185,10 @@ class UniversalAnalyticsProvider extends BaseProvider
"name": "Hit Type",
"group": "general"
},
"en": {
"name": "Hit Type",
"group": "general"
},
"ni": {
"name": "Non-Interaction Hit",
"group": "events"
Expand Down Expand Up @@ -546,14 +550,16 @@ class UniversalAnalyticsProvider extends BaseProvider
handleCustom(url, params)
{
let results = [],
hitType = params.get("t") || "page view",
hitType = params.get("t") || params.get("en") || "page view",
requestType = "";

hitType = hitType.toLowerCase();
if(hitType === "pageview" || hitType === "screenview") {
if(hitType === "pageview" || hitType === "screenview" || hitType === "page_view") {
requestType = "Page View";
} else if(hitType === "transaction" || hitType === "item") {
requestType = "Ecommerce " + hitType.charAt(0).toUpperCase() + hitType.slice(1);
} else if(hitType.indexOf("_")) {
requestType = hitType.replace(/_/g, " ");
} else {
requestType = hitType.charAt(0).toUpperCase() + hitType.slice(1);
}
Expand All @@ -565,4 +571,4 @@ class UniversalAnalyticsProvider extends BaseProvider

return results;
}
}
}
31 changes: 21 additions & 10 deletions test/providers/UniversalAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ test("UniversalAnalyticsProvider pattern should match various UA domains", t =>
"http://www.google-analytics.com/collect?",
"http://www.google-analytics.com/collect/",
"https://www.google-analytics.com/collect/?",
"http://www.google-analytics.com/g/collect",
"http://www.google-analytics.com/g/collect?",
"http://www.google-analytics.com/g/collect/",
"https://www.google-analytics.com/g/collect/?",
"https://www.google-analytics.com/collect"
];

Expand Down Expand Up @@ -50,15 +54,22 @@ test("UniversalAnalyticsProvider returns static data", t => {

test("UniversalAnalyticsProvider returns the hit type", t => {
let provider = new UniversalAnalyticsProvider(),
url = "https://www.google-analytics.com/r/collect?v=1&_v=j68&a=1805905905&t=pageview&_s=1&dl=https%3A%2F%2Fomnibug.io%2F&ul=en-us&de=UTF-8&dt=Omnibug%20%3A%3A%20web%20metrics%20debugging%20tool&sd=24-bit&sr=2560x1440&vp=2560x1307&je=0&_u=KCDAAUIh~&jid=441640597&gjid=200209851&cid=191425359.1527202446&tid=UA-17508125-8&_gid=401227809.1529009937&_r=1&gtm=u64&z=1617633316",
results = provider.parseUrl(url);

let requestType = results.data.find((result) => {
return result.key === "omnibug_requestType";
});

t.is(typeof requestType, "object");
t.is(requestType.value, "Page View");
url1 = "https://www.google-analytics.com/r/collect?v=1&_v=j68&a=1805905905&t=pageview&_s=1&dl=https%3A%2F%2Fomnibug.io%2F&ul=en-us&de=UTF-8&dt=Omnibug%20%3A%3A%20web%20metrics%20debugging%20tool&sd=24-bit&sr=2560x1440&vp=2560x1307&je=0&_u=KCDAAUIh~&jid=441640597&gjid=200209851&cid=191425359.1527202446&tid=UA-17508125-8&_gid=401227809.1529009937&_r=1&gtm=u64&z=1617633316",
url2 = "https://www.google-analytics.com/g/collect?v=2&tid=G-RJZRDLSZR5&gtm=2oe7v2&_p=1844589572&sr=2560x1440&cid=1473268947.1550531325&ul=en-us&_s=1&en=page_view&sid=1565188190&sct=2&seg=1&dl=https%3A%2F%2Fomnibug.io%2Ftest&dr=&dt=Omnibug%20test%20page",
results1 = provider.parseUrl(url1),
results2 = provider.parseUrl(url2);

let requestType1 = results1.data.find((result) => {
return result.key === "omnibug_requestType";
}),
requestType2 = results2.data.find((result) => {
return result.key === "omnibug_requestType";
});

t.is(typeof requestType1, "object");
t.is(requestType1.value, "Page View");
t.is(typeof requestType2, "object");
t.is(requestType2.value, "Page View");
});

test("UniversalAnalyticsProvider returns POST data", t => {
Expand Down Expand Up @@ -123,4 +134,4 @@ test.todo("UniversalAnalyticsProvider returns products");
test.todo("UniversalAnalyticsProvider returns products custom dimensions/metrics");
test.todo("UniversalAnalyticsProvider returns impression lists");
test.todo("UniversalAnalyticsProvider returns impression lists with product-level custom dimensions/metrics");
test.todo("UniversalAnalyticsProvider returns impression lists with product-level information");
test.todo("UniversalAnalyticsProvider returns impression lists with product-level information");

0 comments on commit 9c22dc1

Please sign in to comment.