crowdstart-analytics
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -28,16 +28,19 @@ // Generated by CoffeeScript 1.9.3 | ||
Analytics.prototype.initialize = function(integrations) { | ||
var constructor, integration, name, opts, results; | ||
if (integrations == null) { | ||
integrations = {}; | ||
Analytics.prototype.initialize = function(opts) { | ||
var constructor, i, instance, integration, len, results; | ||
if (opts == null) { | ||
opts = {}; | ||
} | ||
this.log('Analytics.initialize', integrations); | ||
this.log('Analytics.initialize', opts); | ||
if (opts.integrations == null) { | ||
opts.integrations = []; | ||
} | ||
results = []; | ||
for (name in integrations) { | ||
opts = integrations[name]; | ||
constructor = require('./integrations/' + name); | ||
integration = new constructor(opts); | ||
integration.init(); | ||
integration.load(); | ||
integration.log = (function(_this) { | ||
for (i = 0, len = integrations.length; i < len; i++) { | ||
integration = integrations[i]; | ||
constructor = require('./integrations/' + integration.type); | ||
instance = new constructor(integration); | ||
instance.init(); | ||
instance.load(); | ||
instance.log = (function(_this) { | ||
return function() { | ||
@@ -47,3 +50,3 @@ return _this.log.apply(_this, arguments); | ||
})(this); | ||
results.push(this.integrations.push(integration)); | ||
results.push(this.integrations.push(instance)); | ||
} | ||
@@ -50,0 +53,0 @@ return results; |
@@ -15,4 +15,8 @@ // Generated by CoffeeScript 1.9.3 | ||
function FacebookConversions(pixels) { | ||
this.pixels = pixels != null ? pixels : {}; | ||
function FacebookConversions(opts) { | ||
var k, v; | ||
for (k in opts) { | ||
v = opts[k]; | ||
this[k] = v; | ||
} | ||
} | ||
@@ -43,13 +47,13 @@ | ||
FacebookConversions.prototype.track = function(event, props, opts, cb) { | ||
var currency, id, pixel, ref, ref1, ref2, ref3, value; | ||
var currency, id, ref, ref1, ref2, ref3, value; | ||
if (cb == null) { | ||
cb = function() {}; | ||
} | ||
if ((pixel = this.pixels[event]) == null) { | ||
if (event !== this.event) { | ||
return; | ||
} | ||
this.log('FacebookConversions.track', arguments); | ||
id = pixel.id; | ||
value = (ref = (ref1 = props.value) != null ? ref1 : pixel.value) != null ? ref : '0.00'; | ||
currency = (ref2 = (ref3 = props.currency) != null ? ref3 : pixel.currency) != null ? ref2 : 'USD'; | ||
id = this.id; | ||
value = (ref = (ref1 = props.value) != null ? ref1 : this.value) != null ? ref : '0.00'; | ||
currency = (ref2 = (ref3 = props.currency) != null ? ref3 : this.currency) != null ? ref2 : 'USD'; | ||
return _fbq.push([ | ||
@@ -56,0 +60,0 @@ 'track', id, { |
@@ -15,4 +15,8 @@ // Generated by CoffeeScript 1.9.3 | ||
function GoogleAdWords(pixels) { | ||
this.pixels = pixels != null ? pixels : {}; | ||
function GoogleAdWords(opts) { | ||
var k, v; | ||
for (k in opts) { | ||
v = opts[k]; | ||
this[k] = v; | ||
} | ||
this.queue = []; | ||
@@ -53,3 +57,2 @@ } | ||
GoogleAdWords.prototype.page = function(category, name, props, opts, cb) { | ||
var pixel; | ||
if (cb == null) { | ||
@@ -61,3 +64,3 @@ cb = function() {}; | ||
} | ||
if ((pixel = this.pixels[name]) == null) { | ||
if (name !== this.event) { | ||
return; | ||
@@ -67,3 +70,3 @@ } | ||
google_trackConversion({ | ||
google_conversion_id: pixel.id, | ||
google_conversion_id: this.id, | ||
google_custom_params: props, | ||
@@ -76,7 +79,6 @@ google_remarketing_only: true | ||
GoogleAdWords.prototype.track = function(event, props, opts, cb) { | ||
var pixel; | ||
if (cb == null) { | ||
cb = function() {}; | ||
} | ||
if ((pixel = this.pixels[event]) == null) { | ||
if (event !== this.event) { | ||
return; | ||
@@ -86,3 +88,3 @@ } | ||
google_trackConversion({ | ||
google_conversion_id: pixel.id, | ||
google_conversion_id: this.id, | ||
google_custom_params: props, | ||
@@ -89,0 +91,0 @@ google_conversion_language: 'en', |
{ | ||
"name": "crowdstart-analytics", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Analytics support for Crowdstart.", | ||
@@ -5,0 +5,0 @@ "main": "lib", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
139158
1827