nukosuke / rails-react-template

react_on_rails Isomorphic-Single-Page-Application template
http://nukosuke.hatenablog.jp/entry/rails/react_on_rails
Apache License 2.0
4 stars 2 forks source link

google analytics #3

Open nukosuke opened 7 years ago

nukosuke commented 7 years ago
// in header script (application.html.erb)
window.ga = ga;

// clientRegistration.jsx
const unlisten = history.listen(() => {
    ga('send', 'pageView', location.pathname);
});

transition caused by react-router (e.g. click Link comonent) will be tracked.