Socket
Socket
Sign inDemoInstall

@festicket/analytics

Package Overview
Dependencies
2
Maintainers
6
Versions
187
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @festicket/analytics

A better API wrapper for segment. Uses a slightly amended script loading method as opposed to the [Segment Quick Start Guide](https://segment.com/docs/sources/website/analytics.js/quickstart/). Adds automatic tracking to elements that are clicked.


Version published
Maintainers
6
Created

Readme

Source

Analytics

A better API wrapper for segment. Uses a slightly amended script loading method as opposed to the Segment Quick Start Guide. Adds automatic tracking to elements that are clicked.

A polyfill for Element.prototype.closest is required to support older browsers.

Setup

// My App: app/utils/analytics.js
import init from '@festicket/analytics';
export { track, identify, page, group, alias, reset } = init(MySegmentAPIKey);

Then later in your application:

import { track } from 'app/utils/analytics';

// Wait for something which you would like to track
myEvtHandle = async () => {
  await track(/* some data */);
};

Automatic tracking

The initialisation process listens to all click events on your page. If you would like to track a click on an element you can use data attributes to both enable and pass data into your analytics events:

<button
  data-analytics='true'
  data-analytics-my-value='some-value'
>
  This is a button
</button>

<!-- Will result in an analytics payload of { myValue: 'some-value' } -->

FAQs

Last updated on 11 Apr 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc