Skip to content

Latest commit

 

History

History
 
 

analytics-util-router

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Single Page Router utils

A tiny (238 bytes) routing utility for listening to route changes in single page applications.

Install

npm install @analytics/router-utils

Usage

import onRouteChange from '@analytics/router-utils'
import analytics from './analytics'

onRouteChange((newRoutePath) => {
  console.log('new route path', newRoutePath)
  // trigger page view
  analytics.page()
})