Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

universal-analytics

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-analytics - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

AcceptableParams.md

77

lib/config.js

@@ -6,5 +6,78 @@

path: "/collect",
acceptedParameters: ["v", "tid", "aip", "qt", "z", "cid", "sc", "dr", "cn", "cs", "cm", "ck", "cc", "ci", "gclid", "dclid", "sr", "vp", "de", "sd", "ul", "je", "fl", "t", "ni", "dl", "dh", "dp", "dt", "cd", "an", "av", "ec", "ea", "el", "ev", "ti", "ta", "tr", "ts", "tt", "ip", "iq", "ic", "in", "iv", "sn", "sa", "st", "utc", "utv", "utt", "utl", "plt", "dns", "pdt", "rrt", "tcp", "src", "exd", "exf", "p"],
acceptedParameters: ["v","tid","aip","qt","z","cid","uid","sc","uip","ua","dr","cn","cs","cm","ck","cc","ci","gclid","dclid","sr","vp","de","sd","ul","je","fl","t","ni","dl","dh","dp","dt","cd","linkid","an","aid","av","aiid","ec","ea","el","ev","ti","ta","tr","ts","tt","in","ip","iq","ic","iv","cu","sn","sa","st","utc","utv","utt","utl","plt","dns","pdt","rrt","tcp","srt","exd","exf","xid","xvar"],
customMetricRegex: /^cm[0-9]+$/,
customDimensionRegex: /^cd[0-9]+$/
customDimensionRegex: /^cd[0-9]+$/,
parametersMap: {
"protocolVersion": "v",
"trackingId": "tid",
"webPropertyId": "tid",
"anonymizeIp": "aip",
"queueTime": "qt",
"cacheBuster": "z",
"clientId": "cid",
"userId": "uid",
"sessionControl": "sc",
"ipOverride": "uip",
"userAgentOverride": "ua",
"documentReferrer": "dr",
"campaignName": "cn",
"campaignSource": "cs",
"campaignMedium": "cm",
"campaignKeyword": "ck",
"campaignContent": "cc",
"campaignId": "ci",
"googleAdwordsId": "gclid",
"googleDisplayAdsId": "dclid",
"screenResolution": "sr",
"viewportSize": "vp",
"documentEncoding": "de",
"screenColors": "sd",
"userLanguage": "ul",
"javaEnabled": "je",
"flashVersion": "fl",
"hitType": "t",
"non-interactionHit": "ni",
"documentLocationUrl": "dl",
"documentHostName": "dh",
"documentPath": "dp",
"documentTitle": "dt",
"screenName": "cd",
"linkId": "linkid",
"applicationName": "an",
"applicationId": "aid",
"applicationVersion": "av",
"applicationInstallerId": "aiid",
"eventCategory": "ec",
"eventAction": "ea",
"eventLabel": "el",
"eventValue": "ev",
"transactionId": "ti",
"transactionAffiliation": "ta",
"transactionRevenue": "tr",
"transactionShipping": "ts",
"transactionTax": "tt",
"itemName": "in",
"itemPrice": "ip",
"itemQuantity": "iq",
"itemCode": "ic",
"itemCategory": "iv",
"currencyCode": "cu",
"socialNetwork": "sn",
"socialAction": "sa",
"socialActionTarget": "st",
"userTimingCategory": "utc",
"userTimingVariableName": "utv",
"userTimingTime": "utt",
"userTimingLabel": "utl",
"pageLoadTime": "plt",
"dnsTime": "dns",
"pageDownloadTime": "pdt",
"redirectResponseTime": "rrt",
"tcpConnectTime": "tcp",
"serverResponseTime": "srt",
"exceptionDescription": "exd",
"isExceptionFatal?": "exf",
"experimentId": "xid",
"experimentVariant": "xvar"
}
};

30

lib/index.js

@@ -356,3 +356,3 @@

params = params || {};
params = this._translateParams(params) || {};

@@ -420,4 +420,15 @@ _.extend(params, {

},
_translateParams: function (params) {
var translated = {};
for (var key in params) {
if (config.parametersMap.hasOwnProperty(key)) {
translated[config.parametersMap[key]] = params[key];
} else {
translated[key] = params[key];
}
}
return translated;
},
_tidyParameters: function (params) {

@@ -451,16 +462,1 @@ for (var param in params) {

Visitor.prototype.i = Visitor.prototype.item
{
"name": "universal-analytics",
"version": "0.3.4",
"version": "0.3.5",
"description": "A node module for Google's Universal Analytics tracking",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -116,2 +116,4 @@ universal-analytics

See also [a acceptable params](AcceptableParams.md).
## Event tracking

@@ -186,4 +188,4 @@

See also [a acceptable params](AcceptableParams.md).
### Daisy-chaining tracking calls

@@ -311,2 +313,3 @@

See also [a acceptable params](AcceptableParams.md).

@@ -339,4 +342,4 @@ ### Exception tracking

See also [a acceptable params](AcceptableParams.md).
### User timing tracking

@@ -363,4 +366,4 @@

See also [a acceptable params](AcceptableParams.md).
## Session-based identification

@@ -387,4 +390,2 @@

## Debug mode

@@ -391,0 +392,0 @@

@@ -119,2 +119,35 @@

describe("params", function () {
var visitor;
before(function () {
var tid = "UA-XXXXX-XX";
var cid = uuid.v4();
visitor = ua(tid, cid);
});
it('should not translate params', function(){
var params = {
tid: 1,
cid: 1,
somefake: 1,
v: 'a'
};
visitor._translateParams(params).should.eql(params);
})
it('should match all parameters and each should be in the list of accepted', function(){
var res = visitor._translateParams(config.parametersMap);
for (var i in res) {
if (res.hasOwnProperty(i)) {
res[i].should.equal(i);
config.acceptedParameters.should.containEql(i);
}
}
})
});
describe("#debug", function () {

@@ -121,0 +154,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc