mirror of
https://github.com/strapi/strapi.git
synced 2025-11-10 15:19:00 +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 React from 'react';
|
||||||
|
import ReactGA from 'react-ga';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createStructuredSelector } from 'reselect';
|
import { createStructuredSelector } from 'reselect';
|
||||||
@ -71,11 +72,15 @@ export class AdminPage extends React.Component { // eslint-disable-line react/pr
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.checkLogin(this.props);
|
this.checkLogin(this.props);
|
||||||
|
|
||||||
|
ReactGA.initialize('UA-54313258-9');
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (nextProps.location.pathname !== this.props.location.pathname) {
|
if (nextProps.location.pathname !== this.props.location.pathname) {
|
||||||
this.checkLogin(nextProps);
|
this.checkLogin(nextProps);
|
||||||
|
|
||||||
|
ReactGA.pageview(nextProps.location.pathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get(nextProps.plugins.toJS(), ['users-permissions', 'hasAdminUser']) !== get(this.props.plugins.toJS(), ['users-permissions', 'hasAdminUser'])) {
|
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"
|
"setup": "node ./scripts/setup.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"react-ga": "^2.4.1",
|
||||||
"shelljs": "^0.7.8"
|
"shelljs": "^0.7.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -47,4 +48,4 @@
|
|||||||
"npm": ">= 3.0.0"
|
"npm": ">= 3.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user