0.0.1 • Published 22 days ago

@fiddle-digital/string-analytics v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
22 days ago

Alpha

StringAnalytics Library

Overview

StringAnalytics is a versatile JavaScript library designed to facilitate the integration and management of popular analytics frameworks like Google Analytics and Facebook Pixel within web applications. It provides developers with tools to initialize, track events, and dynamically manage analytics scripts, enhancing control over data collection and privacy.

Features

  • Easy Integration: Simplifies the setup of Google Analytics and Facebook Pixel.
  • Event Tracking: Allows developers to send custom event tracking information to analytics platforms.
  • Dynamic Script Management: Offers capabilities to dynamically add or remove analytics scripts, enabling performance optimization and compliance with privacy regulations.
  • Robust Configuration: Supports detailed configuration of tracking parameters and conditions.

Installation

Install StringAnalytics using npm:

npm install @fiddle-digital/string-analytics

##Usage ###Importing

import StringAnalytics from '@fiddle-digital/string-analytics';
Initialization
Initialize Google Analytics and Facebook Pixel:
const analytics = StringAnalytics.getInstance();
analytics.google.init('GA_MEASUREMENT_ID');
analytics.meta.init('FB_PIXEL_ID');

###Tracking Events Track custom events in Google Analytics:

analytics.google.track('GA_MEASUREMENT_ID', 'eventName', { param: 'value' });

Track custom events in Facebook Pixel:

analytics.meta.track('FB_PIXEL_ID', 'eventName', { param: 'value' });

###Disabling Analytics

Disable Google Analytics tracking:

analytics.google.disable('GA_MEASUREMENT_ID');

Disable Facebook Pixel tracking:

analytics.meta.disable('FB_PIXEL_ID');