Skip to content

Commit

Permalink
πŸ› Fixed Analytics
Browse files Browse the repository at this point in the history
Added siteSpeedSampleRate to send 100% of hits.
  • Loading branch information
TheRoro committed Jan 17, 2021
1 parent 399b56a commit 603e6d3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
13 changes: 10 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SearchMove from './Components/Search-Move/SearchMove';
import TeamBuilder from './Components/TeamBuilder/TeamBuilder';
import OlderVersions from './Components/Older-Versions/OlderVersions';
import './Assets/TypeColors.css';
import ReactGa from 'react-ga';
import ReactGA from 'react-ga';
import {
BrowserRouter as Router,
Switch,
Expand All @@ -18,10 +18,17 @@ import {
function App() {

useEffect(() => {
ReactGa.initialize('G-S0XVNHX873')
ReactGA.initialize('G-S0XVNHX873', {
testMode: false,
debug: true,
titleCase: false,
gaOptions: {
siteSpeedSampleRate: 100
}
});

//to report page view
ReactGa.pageview(window.location.pathname + window.location.search);
ReactGA.pageview(window.location.pathname + window.location.search);
}, [])

return (
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Home/HomeComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import Quotes from './Quotes';
import { useHistory } from "react-router-dom";
import ReactGa from 'react-ga';
import ReactGA from 'react-ga';
import {
Title,
Text,
Expand All @@ -18,7 +18,7 @@ const Home: React.FC<{}> = () => {
var max = Quotes.length;
var rand = Math.floor(Math.random() * Math.floor(max));
const clickHandler = () => {
ReactGa.event({
ReactGA.event({
category: 'Button',
action: 'Older Versions'
})
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Navbar/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { useHistory } from "react-router-dom";
import ReactGa from 'react-ga';
import ReactGA from 'react-ga';
import {FaBars} from 'react-icons/fa';
import {
Nav,
Expand All @@ -23,23 +23,23 @@ const Navbar: React.FC<Props> = ({
const clickHandler = (value: string) => {
switch(value) {
case 'search': {
ReactGa.event({
ReactGA.event({
category: 'Button',
action: 'Search Pokemon'
})
history.push(`/search`);
break;
}
case 'move': {
ReactGa.event({
ReactGA.event({
category: 'Button',
action: 'Search Move'
})
history.push(`/move`);
break;
}
default: {
ReactGa.event({
ReactGA.event({
category: 'Button',
action: 'Type Calculator'
})
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Navbar/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { useHistory } from "react-router-dom";
import ReactGa from 'react-ga';
import ReactGA from 'react-ga';
import {
SidebarContainer,
Icon,
Expand All @@ -24,23 +24,23 @@ const SideBar: React.FC<Props> = ({
toggle();
switch(value) {
case 'search': {
ReactGa.event({
ReactGA.event({
category: 'Button',
action: 'Search Pokemon'
})
history.push(`/search`);
break;
}
case 'move': {
ReactGa.event({
ReactGA.event({
category: 'Button',
action: 'Search Move'
})
history.push(`/move`);
break;
}
default: {
ReactGa.event({
ReactGA.event({
category: 'Button',
action: 'Type Calculator'
})
Expand Down

0 comments on commit 603e6d3

Please sign in to comment.