@segment/snippet
Advanced tools
Comparing version 4.12.0 to 4.13.0
@@ -5,3 +5,5 @@ module.exports=function(settings) { | ||
((__t = ( settings.host )) == null ? '' : __t) + | ||
'/analytics.js/v1/\'\n + key + \'/analytics.min.js\';\n\n // Insert our script next to the first script element.\n var first = document.getElementsByTagName(\'script\')[0];\n first.parentNode.insertBefore(script, first);\n analytics._loadOptions = options;\n };\n\n // Add a version to keep track of what\'s in the wild.\n analytics.SNIPPET_VERSION = \'4.1.0\';\n\n // Load Analytics.js with your key, which will automatically\n // load the tools you\'ve enabled for your account. Boosh!\n ' + | ||
'' + | ||
((__t = ( settings.ajsPath )) == null ? '' : __t) + | ||
'\';\n\n // Insert our script next to the first script element.\n var first = document.getElementsByTagName(\'script\')[0];\n first.parentNode.insertBefore(script, first);\n analytics._loadOptions = options;\n };\n\n // Add a version to keep track of what\'s in the wild.\n analytics.SNIPPET_VERSION = \'4.13.0\';\n\n // Load Analytics.js with your key, which will automatically\n // load the tools you\'ve enabled for your account. Boosh!\n ' + | ||
((__t = ( settings.load )) == null ? '' : __t) + | ||
@@ -8,0 +10,0 @@ '\n\n // Make the first page call to load the integrations. If\n // you\'d like to manually name or tag the page, edit or\n // move this call however you\'d like.\n ' + |
@@ -5,3 +5,7 @@ module.exports=function(settings) { | ||
((__t = ( settings.host )) == null ? '' : __t) + | ||
'/analytics.js/v1/"+e+"/analytics.min.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(n,a);analytics._loadOptions=t};analytics.SNIPPET_VERSION="4.1.0";\n' + | ||
'' + | ||
((__t = ( settings.ajsPath )) == null ? '' : __t) + | ||
'";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(n,a);analytics._loadOptions=t};analytics.SNIPPET_VERSION="' + | ||
((__t = ( settings.version )) == null ? '' : __t) + | ||
'";\n' + | ||
((__t = ( settings.load )) == null ? '' : __t) + | ||
@@ -8,0 +12,0 @@ '\n' + |
@@ -0,1 +1,7 @@ | ||
4.13.0 / 2020-08-11 | ||
================== | ||
* added ajsPath option to load from customized location | ||
* updated dependencies | ||
4.12.0 / 2020-05-21 | ||
@@ -2,0 +8,0 @@ ================== |
@@ -56,2 +56,3 @@ 'use strict'; | ||
options.host || (options.host = 'cdn.segment.com'); | ||
options.ajsPath || (options.ajsPath = '/analytics.js/v1/\' + key + \'/analytics.min.js'); | ||
if (!has.call(options, 'page')) options.page = true; | ||
@@ -58,0 +59,0 @@ if (!has.call(options, 'load')) options.load = true; |
{ | ||
"name": "@segment/snippet", | ||
"author": "Segment.io <friends@segment.com>", | ||
"version": "4.12.0", | ||
"version": "4.13.0", | ||
"repository": "git://github.com/segmentio/snippet.git", | ||
@@ -17,3 +17,3 @@ "description": "Templating methods for rendering the analytics.js snippet.", | ||
"browserify-istanbul": "^2.0.0", | ||
"eslint": "^2.13.1", | ||
"eslint": "^4.18.2", | ||
"eslint-plugin-mocha": "^2.2.0", | ||
@@ -20,0 +20,0 @@ "eslint-plugin-require-path-exists": "^1.1.5", |
@@ -8,2 +8,3 @@ 'use strict'; | ||
var mkdirp = require('mkdirp'); | ||
var packageJSON = require('../package.json') | ||
@@ -15,4 +16,4 @@ var source = fs.readFileSync(path.join(__dirname, '../template/snippet.js'), { encoding: 'utf8' }); | ||
var lineRegex = /(<%= settings\.load %>|<%= settings\.page %>|}}\(\);)/g; | ||
var snippet = template(source.replace(loadRegex, '$1').replace(pageRegex, '$1'), { variable: 'settings' }); | ||
var versionRegex = /<%= settings\.version %>/; | ||
var snippet = template(source.replace(loadRegex, '$1').replace(pageRegex, '$1').replace(versionRegex, packageJSON.version), { variable: 'settings' }); | ||
var snippetMin = template(minify(source, { | ||
@@ -19,0 +20,0 @@ mangle: { except: ['analytics'] }, |
@@ -71,4 +71,3 @@ (function(){ | ||
script.async = true; | ||
script.src = 'https://<%= settings.host %>/analytics.js/v1/' | ||
+ key + '/analytics.min.js'; | ||
script.src = 'https://<%= settings.host %><%= settings.ajsPath %>'; | ||
@@ -82,3 +81,3 @@ // Insert our script next to the first script element. | ||
// Add a version to keep track of what's in the wild. | ||
analytics.SNIPPET_VERSION = '4.1.0'; | ||
analytics.SNIPPET_VERSION = '<%= settings.version %>'; | ||
@@ -85,0 +84,0 @@ // Load Analytics.js with your key, which will automatically |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23010
334