Skip to content

Commit

Permalink
added performance analytics (#249)
Browse files Browse the repository at this point in the history
added performance analytics
  • Loading branch information
Sebastian Ovide authored Oct 3, 2019
1 parent c27bcac commit cc66308
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/gtag.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ import config from './custom/config';

export const gtagInit = () => {
if (window.cordova) {
window.ga.startTrackerWithId(config.GA_TRACKING_ID, 1, () => {
window.ga.startTrackerWithId(config.GA_PROPERTY_ID, 1, () => {
window.ga.setAppVersion(process.env.REACT_APP_VERSION);
window.ga.trackEvent('Tech','type','mobile');
window.ga.trackEvent('Tech','app version',process.env.REACT_APP_VERSION);
window.ga.trackEvent('Tech','build number',process.env.REACT_APP_BUILD_NUMBER);
window.ga.trackView('/#/');
window.ga.trackEvent("Tech", "type", "mobile");
window.ga.trackEvent(
"Tech",
"app version",
process.env.REACT_APP_VERSION
);
window.ga.trackEvent(
"Tech",
"build number",
process.env.REACT_APP_BUILD_NUMBER
);
window.ga.trackView("/#/");
});
}
else{
Expand All @@ -19,7 +27,9 @@ export const gtagInit = () => {
gtag("js", new Date());

// this is the new analytics
gtag("config", config.GA_PROPERTY_ID);
gtag("config", config.GA_PROPERTY_ID, {
page_path: "/#/"
});

// it will phased out
gtag("config", config.GA_TRACKING_ID, {
Expand Down Expand Up @@ -51,6 +61,10 @@ export const gtagPageView = (pathname) => {
window.ga.trackView('/#' + pathname);
}
else{
gtag("config", config.GA_PROPERTY_ID, {
page_path: "/#" + pathname
});

gtag('config', config.GA_TRACKING_ID, {
'page_path' : '/#' + pathname
});
Expand Down

0 comments on commit cc66308

Please sign in to comment.