A JavaScript library for integrating Google Analytics into your applications.
To install arcane-fire-analytics, use npm:
npm install arcane-fire-analytics
const { initializeAnalytics, trackEvent, trackPageView } = require('arcane-fire-analytics');
// Initialize Google Analytics
const analytics = initializeAnalytics('YOUR_TRACKING_ID');
// Track an event
trackEvent(analytics, 'category', 'action', 'label', value);
// Track a page view
trackPageView(analytics, '/path');
Initialize Google Analytics with a tracking ID and custom options.
trackingId
: The Google Analytics tracking ID.options
(optional): Additional options for initializing Google Analytics.
Track an event in Google Analytics.
analytics
: The Google Analytics instance returned byinitializeAnalytics
.category
: The category of the event.action
: The action of the event.label
: The label of the event.value
: The value of the event.
Track a page view in Google Analytics.
analytics
: The Google Analytics instance returned byinitializeAnalytics
.path
: The path of the page view.