1.1.0 • Published 2 years ago

nullstack-google-analytics v1.1.0

Weekly downloads
9
License
MIT
Repository
github
Last release
2 years ago

Nullstack Google Analytics

Nullstack wrapper for Google Analytics

Install

npm install --save nullstack-google-analytics

Usage

All you have to do is import and render the Google Analytics tag with your project ID as an attribute

This component will listen for Nullstack route changes and track a PageView

import Nullstack from 'nullstack';
import GoogleAnalytics from 'nullstack-google-analytics';

class Application extends Nullstack {

  render() {
    return (
      <main>
        {/* your routes go here */}
        <GoogleAnalytics id="REPLACE_WITH_YOUR_GOOGLE_ANALYTICS_ID" />
      </main>
    )
  }

}

export default Application;

This component preconnects to https://www.googletagmanager.com and only adds the script tag once the application is hydrated to avoid blocking the first paint.

License

Nullstack Google Analytics is released under the MIT License.

1.1.0

2 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago