mirror of
https://github.com/d07RiV/diabloweb.git
synced 2026-06-03 21:41:38 +00:00
add analytics
This commit is contained in:
7
package-lock.json
generated
7
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "diabloweb",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -10277,6 +10277,11 @@
|
||||
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-5.1.6.tgz",
|
||||
"integrity": "sha512-X1Y+0jR47ImDVr54Ab6V9eGk0Hnu7fVWGeHQSOXHf/C2pF9c6uy3gef8QUeuUiWlNb0i08InPSE5a/KJzNzw1Q=="
|
||||
},
|
||||
"react-ga": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/react-ga/-/react-ga-2.6.0.tgz",
|
||||
"integrity": "sha512-GWHBWZDFjDGMkIk1LzroIn0mNTygKw3adXuqvGvheFZvlbpqMPbHsQsTdQBIxRRdXGQM/Zq+dQLRPKbwIHMTaw=="
|
||||
},
|
||||
"react-is": {
|
||||
"version": "16.8.6",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "diabloweb",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/core": "7.4.3",
|
||||
@@ -49,6 +49,7 @@
|
||||
"react-app-polyfill": "^1.0.1",
|
||||
"react-dev-utils": "^9.0.1",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-ga": "^2.6.0",
|
||||
"resolve": "1.10.0",
|
||||
"sass-loader": "7.1.0",
|
||||
"semver": "6.0.0",
|
||||
|
||||
16
src/App.js
16
src/App.js
@@ -1,11 +1,17 @@
|
||||
import React from 'react';
|
||||
import './App.scss';
|
||||
import classNames from 'classnames';
|
||||
import ReactGA from 'react-ga';
|
||||
|
||||
import create_fs from './fs';
|
||||
import load_game from './api/loader';
|
||||
import { SpawnSize } from './api/load_spawn';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
ReactGA.initialize('UA-43123589-6');
|
||||
ReactGA.pageview('/');
|
||||
}
|
||||
|
||||
function reportLink(e, retail) {
|
||||
const message = e.stack || e.message;
|
||||
const url = new URL("https://github.com/d07RiV/diabloweb/issues/new");
|
||||
@@ -204,7 +210,15 @@ class App extends React.Component {
|
||||
document.removeEventListener("dragleave", this.onDragLeave, true);
|
||||
this.setState({dropping: 0});
|
||||
|
||||
this.setState({loading: true, retail: !!(file && file.name.match(/^diabdat\.mpq$/i))});
|
||||
const retail = !!(file && file.name.match(/^diabdat\.mpq$/i));
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
ReactGA.event({
|
||||
category: 'Game',
|
||||
action: retail ? 'Start Retail' : 'Start Shareware',
|
||||
});
|
||||
}
|
||||
|
||||
this.setState({loading: true, retail});
|
||||
|
||||
load_game(this, file).then(game => {
|
||||
this.game = game;
|
||||
|
||||
Reference in New Issue
Block a user