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

gb-tracker-client

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gb-tracker-client

GroupBy client-side event tracker

  • 1.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7K
increased by311.56%
Maintainers
1
Weekly downloads
 
Created
Source

GroupBy Tracking Client

This can be installed via npm with npm install --save gb-tracker-client

Or it can be directly included from our CDN using:

<script src="https://cdn.groupbyinc.com/TBD/gb-tracker.js"></scipt>

Including it directly from the CDN will create the global variable _GbTracker with the same API as below.

API

const _GbTracker = require('gb-tracker-client');
const gbTracker = new _GbTracker('customerId', 'area');

// Must set the visitor at least once before any events are sent
gbTracker.setVisitor('visitorId', 'sessionId');

// There are four event API's.

// AddToBasket events
gbTracker.sendAddToBasketEvent({
 product:  {
   id:         'asdfasd',
   title:      'super boat',
   price:      100.21,
   qty:        20,
   collection: 'testcollection',  // Optional: Defaults to 'Default'
   category:   'boats',           // Optional
   sku:        'asdfasf98',       // Optional
   margin:     0.81               // Optional
 }
});

// Order events
gbTracker.sendOrderEvent({
 products:  [
   {
     id:         'asdfasd',
     title:      'super boat',
     price:      100.21,
     qty:        20,
     collection: 'testcollection',  // Optional: Defaults to 'Default'
     category:   'boats',           // Optional
     sku:        'asdfasf98',       // Optional
     margin:     0.81               // Optional
   },
   {
     id:         'asdfasd',
     title:      'super boat',
     price:      100.21,
     qty:        20,
     collection: 'testcollection',  // Optional: Defaults to 'Default'
     category:   'boats',           // Optional
     sku:        'asdfasf98',       // Optional
     margin:     0.123              // Optional
   }
 ]
});

// Search events
gbTracker.sendSearchEvent({
 search:   {
   totalRecordCount: 10,
   recordEnd:        10,
   recordStart:      5,
   refinements:      [
     {
       name:  'refined 1',
       value: 'refinedValue'
     }
   ],
   origin:           {              // Optional  
     recommendations: false,
     dym:             false,
     sayt:            false,
     search:          true
   },
   searchTerm:       'searchy searchface',
   searchResponse:   {}             // Entire search response from API 
 }
});

// ViewProduct events
gbTracker.sendViewProductEvent({
 product:  {
   id:         'asdfasd',
   title:      'super boat',
   price:      100.21,
   collection: 'testcollection',  // Optional: Defaults to 'Default'
   category:   'boats',           // Optional
   sku:        'asdfasf98',       // Optional
   margin:     0.81               // Optional
 }
});

// There are also navigation events, which are sent silently when page or URL changes

Keywords

FAQs

Package last updated on 19 Jul 2016

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