0.1.1 • Published 5 months ago

@analytics/router-utils v0.1.1

Weekly downloads
52
License
MIT
Repository
github
Last release
5 months ago

Single Page Router utils

A tiny (584 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()
})