@fiddle-digital/string-analytics
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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

Package Sidebar

Install

npm i @fiddle-digital/string-analytics

Weekly Downloads

24

Version

0.0.1

License

MIT

Unpacked Size

16.7 kB

Total Files

11

Last publish

Collaborators

  • penev_palemiya
  • dtroshchylo