All Projects → seeden → React G Analytics

seeden / React G Analytics

Licence: mit
React google analytics with support for react-router

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React G Analytics

Google Analytics Api Symfony
Google Analytics API Symfony Bundle
Stars: ✭ 43 (-62.93%)
Mutual labels:  google-analytics
Ganalytics
Interact with Google Analytics using R
Stars: ✭ 77 (-33.62%)
Mutual labels:  google-analytics
Nothing Private
Do you think you are safe using private browsing or incognito mode?. 😄 👿 This will prove that you're wrong.
Stars: ✭ 1,375 (+1085.34%)
Mutual labels:  google-analytics
Google Measurement Php Client
PHP Client to send analytics data over the Google Measurement Protocol to Google Analytics
Stars: ✭ 52 (-55.17%)
Mutual labels:  google-analytics
As3 Universal Analytics
Google Universal Analytics for AS3
Stars: ✭ 73 (-37.07%)
Mutual labels:  google-analytics
Google Analytics Plugin
Cordova Google Analytics Plugin for Android & iOS
Stars: ✭ 90 (-22.41%)
Mutual labels:  google-analytics
Gumshoe
A we analytics and event tracking sleuth JavaScript library
Stars: ✭ 39 (-66.38%)
Mutual labels:  google-analytics
Crmint
Reliable data integration & processing for advertisers
Stars: ✭ 106 (-8.62%)
Mutual labels:  google-analytics
Meteor Iron Router Ga
Google analytics for Iron Router
Stars: ✭ 76 (-34.48%)
Mutual labels:  google-analytics
Web Analytics
监测分析、异常监测、广告验证、访客唯一标识
Stars: ✭ 97 (-16.38%)
Mutual labels:  google-analytics
Kindmetrics
Kind metrics analytics for your website
Stars: ✭ 57 (-50.86%)
Mutual labels:  google-analytics
React Router Ga
Google Analytics component for React Router
Stars: ✭ 66 (-43.1%)
Mutual labels:  google-analytics
Middleman Google Analytics
📈 A @middleman plugin to handle generating your Google Analytics tracking code.
Stars: ✭ 91 (-21.55%)
Mutual labels:  google-analytics
Plugin Ga
Google Analytics tracking for your book
Stars: ✭ 44 (-62.07%)
Mutual labels:  google-analytics
Appmetrics.js
A small (< 1kb) library for measuring things in your web app and reporting the results to Google Analytics.
Stars: ✭ 1,383 (+1092.24%)
Mutual labels:  google-analytics
App
Just a little analytics insight for your personal or indie project
Stars: ✭ 40 (-65.52%)
Mutual labels:  google-analytics
Newspaper
An aggregated newspaper app containing news from 10+ local news publishers in Hong Kong. Made with ❤
Stars: ✭ 82 (-29.31%)
Mutual labels:  google-analytics
Hugo Nederburg Theme
Nederburg is a fast and secure hugo theme and is a port of the Tracks WP theme
Stars: ✭ 107 (-7.76%)
Mutual labels:  google-analytics
Instantanalytics
DEPRECATED Instant Analytics brings full Google Analytics support to your Twig templates and automatic Craft Commerce integration with Google Enhanced Ecommerce.
Stars: ✭ 103 (-11.21%)
Mutual labels:  google-analytics
Angular Gtag
🔖 Google Analytics gtag.js for Angular
Stars: ✭ 95 (-18.1%)
Mutual labels:  google-analytics

React Google Analytics

NPM version

Motivation

I needed google analytics working in combination with react-router.

Install

npm install react-g-analytics

Features

  • Automatically load google analytics scripts (optional - id parameter)
  • Automatically send pageview when user will change current route of react-router

Support us

Star this project on GitHub.

Notice

Use version 0.3.x of the react-g-analytics if you want to use it with react-router 4.x Use version 0.2.x of the react-g-analytics if you want to use it with react-router 2.x or 3.x

Usage

Example react-router 4.x

User BrowserRouter from react-g-analytics instead of react-router.

import { BrowserRouter } from 'react-g-analytics';

export default function MyComponent() {
  return (
    <BrowserRouter id="UA-*******-**">
      ... your application
    <BrowserRouter>
  );
}

>

Example react-router 3.x and bellow

App.jsx

Application part (load google analytics script to your webpage on the client side). ReactGAnalytics has parameter ID (use your own ID)

var React = require('react');
var GoogleAnalytics = require('react-g-analytics');

var App = module.exports = React.createClass({
  render: function() {
    return (
      <div id="application">
        <GoogleAnalytics id="UA-*******-**" />
        <RouteHandler />
      </div>
    );
  }
});

routes.jsx

Define your routes here.

var React = require('react');
var Router = require('react-router');
var Route = Router.Route;
var DefaultRoute = Router.DefaultRoute;
var Index = require('./Index.jsx');
var App = require('./App.jsx');

var routes = module.exports = (
  <Route handler={App} name="index" path="/">
    <DefaultRoute handler={Index} />
  </Route>
);

client.js

Here is a simple client side

var React = require('react');
var app = require('./App.jsx');
var routes = require('./routes.jsx');

var router = Router.create({
  routes: routes
});

router.run(function(Handler, state) {
  React.render(React.createElement(Handler, {}), node);
});

Set

If you want to set google analytics parameters after load you can use property named set. Here is small example:

var React = require('react');
var GoogleAnalytics = require('react-g-analytics');
var RouteHandler = require('react-router').RouteHandler;

var set = {
  anonymizeIp: true
};

var App = module.exports = React.createClass({
  render: function() {
    return (
      <div id="application">
        <GoogleAnalytics id="UA-*******-**" set={set} />
        <RouteHandler />
      </div>
    );
  }
});

Skip loading google analytics scripts

If you are loading the GA in different way. You can skip autoload of the GA script simply: Do not enter your google analytics ID as parameter.

Try our other React components

Support us

Star this project on GitHub.

Credits

Zlatko Fedor

License

The MIT License (MIT)

Copyright (c) 2016 Zlatko Fedor [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].