@ventrane/react-va
v1.0.9
Published
React Ventrane Analytics
Downloads
7
Maintainers
Readme
react-va
React Ventrane Analytics Module
This is a JavaScript module that can be used to include Ventrane Analytics tracking code in a website or app that uses React for its front-end codebase.
If you use react-va
too, we'd love your feedback. Feel free to file issues, ideas and pull requests against this repo.
Installation
With npm:
npm i @ventrane/react-va
Usage
- Initializing VA:
Pass the initialize method where it will be accessible to all your pages. For example: App.js
import { initialize } from '@ventrane/react-va';
initialize('Va-905cb');
- Track Page Views
import { pageView } from '@ventrane/react-va';
const pagePath = window.location.pathname + window.location.search;
const accessId = get accessId from your Project Ventrane Analytics Dashboard;
const APIKey = get APIKey from your Project Ventrane Analytics Dashboard;
pageView(pagePath, accessId, APIKey);
- Track clicks
import { click } from '@ventrane/react-va';
const accessId = get accessId from your Project Ventrane Analytics Dashboard;
const APIKey = get APIKey from your Project Ventrane Analytics Dashboard;
click(buttonName, accessId, APIKey);
API
initialize(platformName)
VA must be initialized using this function before any of the other tracking functions will record any data. The platform Name can be seen under Configuration Keys in your Project's Ventrane Analytics Dashboard.
Development
Submitting changes/fixes
Follow instructions inside CONTRIBUTING.md