simple-tracking

0.0.7 • Public • Published

Simple tracking

This repo will give a simple way to control your tracking setup no matter which tracking setup you have in the frontend.

How to use it

You would need to import the library and then subscribe to the events. I would recommend creating a tracking folder, and then do this setup:

/tracking/index.js

import Tracker from "simple-tracking";

var tracker = Tracker.create({
  // Insert settings here
});

tracker.subscribe('pageview', function(data){
  // Send tracking for pageview here
});
tracker.subscribe('event/tester-event-name', function(data){
  // Send tracking for event/tester-event-name here
});

export default tracker;

And then you are able to import your tracker and execute the following events:

import tracker from "/tracking";

// execute a pageview
tracker.pageview({
  title: "Hallo world"
});

// execute an event
tracker.event("tester-event-name", {
  some: "data"
});

Package Sidebar

Install

npm i simple-tracking

Weekly Downloads

1

Version

0.0.7

License

MIT

Unpacked Size

26.9 kB

Total Files

19

Last publish

Collaborators

  • andreasgj