@ventrane/react-va

React Ventrane Analytics

Usage no npm install needed!

<script type="module">
  import ventraneReactVa from 'https://cdn.skypack.dev/@ventrane/react-va';
</script>

README

react-va

React Ventrane Analytics Module

npm version npm downloads

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

  1. 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');
  1. 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);
  1. 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