Socket
Socket
Sign inDemoInstall

@segment/snippet

Package Overview
Dependencies
Maintainers
63
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@segment/snippet - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

4

dist/max.template.js
module.exports=function(settings) {
var __t, __p = '';
__p += '(function(){\n\n // Create a queue, but don\'t obliterate an existing one!\n var analytics = window.analytics = window.analytics || [];\n\n // If the real analytics.js is already on the page return.\n if (analytics.initialize) return;\n\n // If the snippet was invoked already show an error.\n if (analytics.invoked) {\n if (window.console && console.error) {\n console.error(\'Segment snippet included twice.\');\n }\n return;\n }\n\n // Invoked flag, to make sure the snippet\n // is never invoked twice.\n analytics.invoked = true;\n\n // A list of the methods in Analytics.js to stub.\n analytics.methods = [\n \'trackSubmit\',\n \'trackClick\',\n \'trackLink\',\n \'trackForm\',\n \'pageview\',\n \'identify\',\n \'reset\',\n \'group\',\n \'track\',\n \'ready\',\n \'alias\',\n \'debug\', \n \'page\',\n \'once\',\n \'off\',\n \'on\'\n ];\n\n // Define a factory to create stubs. These are placeholders\n // for methods in Analytics.js so that you never have to wait\n // for it to load to actually record data. The `method` is\n // stored as the first argument, so we can replay the data.\n analytics.factory = function(method){\n return function(){\n var args = Array.prototype.slice.call(arguments);\n args.unshift(method);\n analytics.push(args);\n return analytics;\n };\n };\n\n // For each of our methods, generate a queueing stub.\n for (var i = 0; i < analytics.methods.length; i++) {\n var key = analytics.methods[i];\n analytics[key] = analytics.factory(key);\n }\n\n // Define a method to load Analytics.js from our CDN,\n // and that will be sure to only ever load it once.\n analytics.load = function(key){\n // Create an async script element based on your key.\n var script = document.createElement(\'script\');\n script.type = \'text/javascript\';\n script.async = true;\n script.src = (\'https:\' === document.location.protocol\n ? \'https://\' : \'http://\')\n + \'' +
__p += '(function(){\n\n // Create a queue, but don\'t obliterate an existing one!\n var analytics = window.analytics = window.analytics || [];\n\n // If the real analytics.js is already on the page return.\n if (analytics.initialize) return;\n\n // If the snippet was invoked already show an error.\n if (analytics.invoked) {\n if (window.console && console.error) {\n console.error(\'Segment snippet included twice.\');\n }\n return;\n }\n\n // Invoked flag, to make sure the snippet\n // is never invoked twice.\n analytics.invoked = true;\n\n // A list of the methods in Analytics.js to stub.\n analytics.methods = [\n \'trackSubmit\',\n \'trackClick\',\n \'trackLink\',\n \'trackForm\',\n \'pageview\',\n \'identify\',\n \'reset\',\n \'group\',\n \'track\',\n \'ready\',\n \'alias\',\n \'debug\', \n \'page\',\n \'once\',\n \'off\',\n \'on\'\n ];\n\n // Define a factory to create stubs. These are placeholders\n // for methods in Analytics.js so that you never have to wait\n // for it to load to actually record data. The `method` is\n // stored as the first argument, so we can replay the data.\n analytics.factory = function(method){\n return function(){\n var args = Array.prototype.slice.call(arguments);\n args.unshift(method);\n analytics.push(args);\n return analytics;\n };\n };\n\n // For each of our methods, generate a queueing stub.\n for (var i = 0; i < analytics.methods.length; i++) {\n var key = analytics.methods[i];\n analytics[key] = analytics.factory(key);\n }\n\n // Define a method to load Analytics.js from our CDN,\n // and that will be sure to only ever load it once.\n analytics.load = function(key, integrationOptions){\n // Create an async script element based on your key.\n var script = document.createElement(\'script\');\n script.type = \'text/javascript\';\n script.async = true;\n script.src = (\'https:\' === document.location.protocol\n ? \'https://\' : \'http://\')\n + \'' +
((__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 };\n\n // Add a version to keep track of what\'s in the wild.\n analytics.SNIPPET_VERSION = \'4.0.0\';\n\n // Load Analytics.js with your key, which will automatically\n // load the tools you\'ve enabled for your account. Boosh!\n analytics.load("' +
'/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.integrationOptions = integrationOptions;\n };\n\n // Add a version to keep track of what\'s in the wild.\n analytics.SNIPPET_VERSION = \'4.0.1\';\n\n // Load Analytics.js with your key, which will automatically\n // load the tools you\'ve enabled for your account. Boosh!\n analytics.load("' +
((__t = ( settings.apiKey )) == null ? '' : __t) +

@@ -7,0 +7,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 ' +

module.exports=function(settings) {
var __t, __p = '';
__p += '!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"' +
__p += '!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t,e){var n=document.createElement("script");n.type="text/javascript";n.async=!0;n.src=("https:"===document.location.protocol?"https://":"http://")+"' +
((__t = ( settings.host )) == null ? '' : __t) +
'/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";\nanalytics.load("' +
'/analytics.js/v1/"+t+"/analytics.min.js";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(n,o);analytics.integrationOptions=e};analytics.SNIPPET_VERSION="4.0.1";\nanalytics.load("' +
((__t = ( settings.apiKey )) == null ? '' : __t) +

@@ -7,0 +7,0 @@ '");\n' +

4.1.0 / 2018-02-14
==================
* Add options to load
4.0.0 / 2016-09-14

@@ -3,0 +8,0 @@ ==================

@@ -36,7 +36,2 @@ /* eslint-env node */

},
sl_ie_8: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '8'
},
sl_ie_9: {

@@ -43,0 +38,0 @@ base: 'SauceLabs',

{
"name": "@segment/snippet",
"author": "Segment.io <friends@segment.com>",
"version": "4.0.1",
"version": "4.1.0",
"repository": "git://github.com/segmentio/snippet.git",

@@ -6,0 +6,0 @@ "description": "Templating methods for rendering the analytics.js snippet.",

@@ -62,3 +62,3 @@ (function(){

// and that will be sure to only ever load it once.
analytics.load = function(key){
analytics.load = function(key, options){
// Create an async script element based on your key.

@@ -76,6 +76,7 @@ var script = document.createElement('script');

first.parentNode.insertBefore(script, first);
analytics._loadOptions = options;
};
// Add a version to keep track of what's in the wild.
analytics.SNIPPET_VERSION = '4.0.0';
analytics.SNIPPET_VERSION = '4.1.0';

@@ -82,0 +83,0 @@ // Load Analytics.js with your key, which will automatically

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