mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Merge pull request #811 from strapi/ga-admin
Add ga in admin to improve Strapi
This commit is contained in:
commit
4d5e02cd8b
@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import ReactGA from 'react-ga';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
@ -71,11 +72,15 @@ export class AdminPage extends React.Component { // eslint-disable-line react/pr
|
||||
|
||||
componentDidMount() {
|
||||
this.checkLogin(this.props);
|
||||
|
||||
ReactGA.initialize('UA-54313258-9');
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.location.pathname !== this.props.location.pathname) {
|
||||
this.checkLogin(nextProps);
|
||||
|
||||
ReactGA.pageview(nextProps.location.pathname);
|
||||
}
|
||||
|
||||
if (get(nextProps.plugins.toJS(), ['users-permissions', 'hasAdminUser']) !== get(this.props.plugins.toJS(), ['users-permissions', 'hasAdminUser'])) {
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
"setup": "node ./scripts/setup.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"react-ga": "^2.4.1",
|
||||
"shelljs": "^0.7.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -47,4 +48,4 @@
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user