ember-cli-google-analytics
Advanced tools
Comparing version 1.0.0 to 1.1.0
# ember-cli-google-analytics Changelog | ||
### 1.1.0 | ||
Adds support for cookie-related settings: `cookieDomain`, `cookieName`, and `cookieExpires`. This applies to analytics.js only. | ||
### 1.0.0 | ||
Initial release of the ember-cli-google-analytics addon |
24
index.js
@@ -7,6 +7,26 @@ 'use strict'; | ||
tracker: 'analytics.js', | ||
webPropertyId: null | ||
webPropertyId: null, | ||
cookieDomain: null, | ||
cookieName: null, | ||
cookieExpires: null | ||
}; | ||
function analyticsTrackingCode(config) { | ||
var gaConfig = {}; | ||
if (config.cookieDomain != null) { | ||
gaConfig.cookieDomain = config.cookieDomain; | ||
} | ||
if (config.cookieName != null) { | ||
gaConfig.cookieName = config.cookieName; | ||
} | ||
if (config.cookieExpires != null) { | ||
gaConfig.cookieExpires = config.cookieExpires; | ||
} | ||
if (Object.keys(gaConfig).length === 0) { | ||
gaConfig = "'auto'"; | ||
} else { | ||
gaConfig = JSON.stringify(gaConfig); | ||
} | ||
return [ | ||
@@ -19,3 +39,3 @@ "<script>", | ||
"", | ||
"" + config.globalVariable + "('create', '" + config.webPropertyId + "', 'auto');", | ||
"" + config.globalVariable + "('create', '" + config.webPropertyId + "', " + gaConfig + ");", | ||
"" + config.globalVariable + "('send', 'pageview');", | ||
@@ -22,0 +42,0 @@ "</script>" |
{ | ||
"name": "ember-cli-google-analytics", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
6792
71