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

analytics-event

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analytics-event

Utility for working with analytics events server-side and in the browser.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

analyticsEvent

A tiny utility for working with analytics events
on the server and in the browser.



Getting Started

Installation

Install with npm:

npm install --save analytics-event

Or with yarn:

yarn add analytics-event
Examples
import AEvent from 'analytics-event'

// Generate event from options 
AEvent({
  name: 'User Signed Up',
  properties: {
    referral_type: 'friend'
  }
})

// Use your favorite analytics library to send events
analytics.track(AEvent({
  name: 'User Signed Up',
  properties: {
    referral_type: 'friend'
  }
}))

Usage

Generating an event
import AEvent from 'analytics-event'

// Generate an event that follows https://schema.org/AnalyticsEvent
AEvent({
  name: 'User Signed Up',
  properties: {
    referral_type: 'friend'
  }
})
Formatting an event
import AEvent from 'analytics-event'

// You can also just import the format function with:
// import { format, loadFormat } from 'analytics-event'
import internalDataFormat from './internal-data-format'

AEvent.loadFormat('internal-data', internalDataFormat)

function receiveIncomingEvents(batch) {
  return batch.map(msg => AEvent.format(msg, {
    preset: 'internal-data'
  }))
}

Contributing

All contributions are super welcome! analytics-event is MIT-licensed.

Keywords

FAQs

Package last updated on 23 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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