项目作者: realAlexBarge

项目描述 :
Un-official module to easily add Taboola pageview tracking to react apps
高级语言: JavaScript
项目地址: git://github.com/realAlexBarge/react-tracking-taboola.git
创建时间: 2019-11-04T15:27:57Z
项目社区:https://github.com/realAlexBarge/react-tracking-taboola

开源协议:MIT License

下载


React Tracking Taboola

Build Status dependencies Status devDependencies Status License: MIT

Un-official module to easily add Taboola pageview tracking to react apps. It functions as a tiny wrapper for the native script tag and window api. After initialization the Taboola script is injected into the document.

Installation

With npm:

  1. npm install react-tracking-taboola --save

Usage

Before tracking any page views or events the tracker needs to be imported and initialized with the custom tracking id:

  1. import TaboolaTracking from 'react-tracking-taboola';
  2. TaboolaTracking.initialize('TRACKING_ID');

After initializing page views can be tracked like this:

  1. TaboolaTracking.trackPageview();

There is also the option to track custom events with event action:

  1. TaboolaTracking.trackEvent(eventAction);

There is also a method to expose the raw _tfa tracking object api from the window:

  1. TaboolaTracking.getTracker();

How this works

This modules takes care of injecting the provider specific tracking script into the document and provides a tiny wrapper for the tracking api. It also exposes the tracker object api for direct access.

Documentation for the raw tracker api can be found here and here.