-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matthias Isler
committed
Jul 24, 2018
1 parent
ca29526
commit 8070941
Showing
6 changed files
with
14 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ Adds a hidden input to the specified form containing a JSON string with parsed i | |
|
||
``` | ||
<!-- Add before </body> for all domains you want to include in tracking --> | ||
<script src="https://cdn.jsdelivr.net/gh/spiritix/[email protected].0/dist/ga-legacy-cookie-parser.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/spiritix/[email protected].1/dist/ga-legacy-cookie-parser.min.js"></script> | ||
<script> | ||
var parser = new GAParser(['mydomain.com', 'second.com']); | ||
console.log(parser.getInfo()); // Output info to console | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"title": "GA Legacy Cookie Parser", | ||
"name": "ga-legacy-cookie-parser-js", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"author": "Matthias Isler <[email protected]>", | ||
"description": "A workaround for accessing GA data in Universal Analytics environments.", | ||
"keywords": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
/*! | ||
* GA Legacy Cookie Parser v0.2.0 | ||
* GA Legacy Cookie Parser v0.2.1 | ||
* | ||
* A workaround for accessing GA data in Universal Analytics environments. | ||
* https://github.com/spiritix/ga-legacy-cookie-parser | ||
* | ||
* Copyright © Matthias Isler <[email protected]> | ||
* Licensed under MIT | ||
*/ | ||
/* globals exports, module, define */ | ||
(function (window, undefined) { | ||
'use strict'; | ||
|
||
|
@@ -50,7 +51,7 @@ | |
name = links[i].href; | ||
} | ||
|
||
if (onClick != null) { | ||
if (onClick !== null) { | ||
onClick = String(onClick); | ||
|
||
if (onClick.indexOf('_gasf.push') > -1) { | ||
|
@@ -59,10 +60,10 @@ | |
} | ||
|
||
for (var j = 0; j < domains.length; j++) { | ||
if (name != hostname && name.indexOf(domains[j]) != -1 && name.indexOf('mailto:') == -1) { | ||
if (name !== hostname && name.indexOf(domains[j]) !== -1 && name.indexOf('mailto:') == -1) { | ||
|
||
links[i].setAttribute('onclick', | ||
'' + ((onClick != null) ? onClick + '; ' : '') + | ||
'' + ((onClick !== null) ? onClick + '; ' : '') + | ||
"_gaq.push(['xxga._link', '" + links[i].href + "']); return false;" | ||
); | ||
} | ||
|
@@ -100,7 +101,7 @@ | |
info.domainHash = content[0]; | ||
info.pageViews = content[1] && Number(content[1]); | ||
info.outboundClick = content[2] && Number(content[2]); | ||
info.currentVisit = content[3] && Number(content[3]) | ||
info.currentVisit = content[3] && Number(content[3]); | ||
} | ||
else if (type === 'utmc') { | ||
info.domainHash = content[0]; | ||
|
@@ -119,9 +120,9 @@ | |
param = param.split('='); | ||
|
||
try { | ||
info[param[0]] = global.unescape(/^\(.*\)$/.test(param[1]) ? | ||
param[1].replace(/^\(?(.*?)\)?$/, '$1') : | ||
param[1]); | ||
info[param[0]] = decodeURI( | ||
/^\(.*\)$/.test(param[1]) ? param[1].replace(/^\(?(.*?)\)?$/, '$1') : param[1] | ||
); | ||
} | ||
catch (e) { | ||
info[param[0]] = param[1]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters