JSPM

@fiddle-digital/string-analytics

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q27053F
  • License MIT

A comprehensive JavaScript library for integrating and managing Google Analytics and Facebook Pixel in web applications. Supports initialization, event tracking, and dynamic management of analytics scripts with easy setup and teardown capabilities. Ideal for developers needing precise control over analytics tracking and performance optimization.

Package Exports

  • @fiddle-digital/string-analytics
  • @fiddle-digital/string-analytics/dist/index.esm.js
  • @fiddle-digital/string-analytics/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@fiddle-digital/string-analytics) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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