Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/njakob/gtag
Simple Google Analytics wrapper for Redux
https://github.com/njakob/gtag
Last synced: 17 days ago
JSON representation
Simple Google Analytics wrapper for Redux
- Host: GitHub
- URL: https://github.com/njakob/gtag
- Owner: njakob
- License: mit
- Created: 2018-01-07T14:01:00.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-07T14:08:08.000Z (almost 7 years ago)
- Last Synced: 2024-12-16T18:29:34.624Z (17 days ago)
- Language: JavaScript
- Size: 39.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
gtag
Simple Google Analytics wrapper for Redux## Installation
```
$ npm install @njakob/gtag
``````
$ yarn add @njakob/gtag
```## Usage
### Redux
```js
import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
import * as gtag from '@njakob/gtag';const yourEnhancers = compose(
applyMiddleware(
gtag.middleware({ gaTrackingID: 'YOUR_TRACKING_ID' }),
// Other middlewares
),
);const store = createStore(yourReducer, yourEnhancers);
``````js
store.dispatch(gtag.trackPageViewAction('/'))
```### Server side
```js
import { getSnippet } from '@njakob/gtag';export default () => `
${gtag.getSnippet()}
`;
```## Changelog
See [changelog](CHANGELOG).
## License
[MIT License](LICENSE)