Socket
Socket
Sign inDemoInstall

universal-analytics

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-analytics

A node module for Google's Universal Analytics tracking


Version published
Weekly downloads
568K
decreased by-20.84%
Maintainers
1
Weekly downloads
 
Created

What is universal-analytics?

The universal-analytics npm package is a Node.js module for interacting with Google Analytics. It allows you to send data to Google Analytics from your server-side applications, enabling you to track user interactions, events, and other metrics programmatically.

What are universal-analytics's main functionalities?

Tracking Page Views

This feature allows you to track page views. The code sample demonstrates how to send a page view hit to Google Analytics for the '/home' page.

const ua = require('universal-analytics');
const visitor = ua('UA-XXXX-Y');
visitor.pageview('/home').send();

Tracking Events

This feature allows you to track events. The code sample shows how to send an event hit with a category, action, label, and value.

const ua = require('universal-analytics');
const visitor = ua('UA-XXXX-Y');
visitor.event('Category', 'Action', 'Label', 42).send();

Tracking Custom Dimensions and Metrics

This feature allows you to track custom dimensions and metrics. The code sample demonstrates how to send a page view hit with custom dimension and metric values.

const ua = require('universal-analytics');
const visitor = ua('UA-XXXX-Y');
visitor.pageview('/home', {cd1: 'Custom Dimension 1', cm1: 100}).send();

User Timing Tracking

This feature allows you to track user timings. The code sample shows how to send a timing hit with a category, variable, time in milliseconds, and label.

const ua = require('universal-analytics');
const visitor = ua('UA-XXXX-Y');
visitor.timing('Category', 'Variable', 123, 'Label').send();

Other packages similar to universal-analytics

Keywords

FAQs

Package last updated on 25 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc