Skip to content

rzostek/arcane-fire-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arcane-fire-analytics

A JavaScript library for integrating Google Analytics into your applications.

Installation

To install arcane-fire-analytics, use npm:

npm install arcane-fire-analytics

Usage

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

API

initializeAnalytics(trackingId, options)

Initialize Google Analytics with a tracking ID and custom options.

  • trackingId: The Google Analytics tracking ID.
  • options (optional): Additional options for initializing Google Analytics.

trackEvent(analytics, category, action, label, value)

Track an event in Google Analytics.

  • analytics: The Google Analytics instance returned by initializeAnalytics.
  • category: The category of the event.
  • action: The action of the event.
  • label: The label of the event.
  • value: The value of the event.

trackPageView(analytics, path)

Track a page view in Google Analytics.

  • analytics: The Google Analytics instance returned by initializeAnalytics.
  • path: The path of the page view.

About

A JavaScript library for integrating Google Analytics.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published