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

analytics.js-loader

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analytics.js-loader - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

4

HISTORY.md

@@ -0,1 +1,5 @@

# 1.0.1 (2015-02-10)
* fix snippet integration, do no try to be smart
# 1.0.0 (2015-01-29)

@@ -2,0 +6,0 @@

20

index.js
module.exports = load;
function load(opts) {
if (global.analytics) {
return global.analytics;
}
// Create a queue, but don't obliterate an existing one!

@@ -12,4 +8,16 @@ var analytics = global.analytics = global.analytics || [];

// If the real analytics.js is already on the page return.
if (analytics.initialize) return analytics;
if (analytics.initialize) return;
// If the snippet was invoked already show an error.
if (analytics.invoked) {
if (window.console && console.error) {
console.error('Segment snippet included twice.');
}
return;
}
// Invoked flag, to make sure the snippet
// is never invoked twice.
analytics.invoked = true;
// A list of the methods in Analytics.js to stub.

@@ -80,4 +88,2 @@ analytics.methods = [

analytics.page();
return analytics;
}
{
"name": "analytics.js-loader",
"version": "1.0.0",
"version": "1.0.1",
"description": "Asynchronously load segment.com analytics.js with an npm module",

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

# analytics.js-loader
Asynchronously load segment.com's
[analytics.js](https://segment.com/docs/libraries/analytics.js/).
This is the [segment.com snippet](https://segment.com/docs/libraries/analytics.js/quickstart/#step-1-copy-the-snippet) as a module.

@@ -19,7 +16,7 @@

```js
var analytics = require('analytics.js-loader')({
require('analytics.js-loader')({
writeKey: 'YOUR_WRITE_KEY'
});
analytics.identify('1e810c197e', {
global.analytics.identify('1e810c197e', {
name: 'Bill Lumbergh',

@@ -29,3 +26,3 @@ email: 'bill@initech.com'

analytics.track('Signed Up', {
global.analytics.track('Signed Up', {
plan: 'Startup',

@@ -32,0 +29,0 @@ source: 'Analytics Academy'

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