Skip to content

Commit

Permalink
analytics (#248)
Browse files Browse the repository at this point in the history
* put the old tracking ID back. We have the new and old until when the old is phased out

* .
  • Loading branch information
Sebastian Ovide authored Oct 3, 2019
1 parent 40b9a33 commit c27bcac
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
3 changes: 2 additions & 1 deletion src/custom/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ export default {
// MAP_ATTRIBUTION: "Contains OS data © Crown copyright and database rights 2018",
MAPBOX_TOKEN:
"pk.eyJ1Ijoic2ViYXN0aWFub3ZpZGVnZW92YXRpb251ayIsImEiOiJjanBqZzRmNHgwNXljM2tydHlkM29id3FwIn0.-1V8Ue9P6eQr8FGghaTYiw",
GA_TRACKING_ID: "189010506",
GA_TRACKING_ID: "UA-126516084-1",
GA_PROPERTY_ID: "189010506",
PHOTO_ZOOMED_FIELDS: {
updated: s => new Date(s).toDateString(),
pieces: s => s
Expand Down
52 changes: 28 additions & 24 deletions src/gtag.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,39 @@ export const gtagInit = () => {
});
}
else{
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = `https://www.googletagmanager.com/gtag/js?id=${config.GA_TRACKING_ID}`;
document.body.appendChild(script);
const script = document.createElement("script");
script.type = "text/javascript";
script.src = `https://www.googletagmanager.com/gtag/js?id=${config.GA_PROPERTY_ID}`;
document.body.appendChild(script);

gtag('js', new Date());
gtag('config', config.GA_TRACKING_ID, {
'page_path' : '/#/'
});
gtag("js", new Date());

gtag('event', 'app version', {
'event_category' : 'Tech',
'event_label' : process.env.REACT_APP_VERSION,
'non_interaction': true
});
// this is the new analytics
gtag("config", config.GA_PROPERTY_ID);

gtag('event', 'build number', {
'event_category' : 'Tech',
'event_label' : process.env.REACT_APP_BUILD_NUMBER,
'non_interaction': true
});
// it will phased out
gtag("config", config.GA_TRACKING_ID, {
page_path: "/#/"
});

gtag('event', 'type', {
'event_category' : 'Tech',
'event_label' : 'web',
'non_interaction': true
});
gtag("event", "app version", {
event_category: "Tech",
event_label: process.env.REACT_APP_VERSION,
non_interaction: true
});

}
gtag("event", "build number", {
event_category: "Tech",
event_label: process.env.REACT_APP_BUILD_NUMBER,
non_interaction: true
});

gtag("event", "type", {
event_category: "Tech",
event_label: "web",
non_interaction: true
});
}
}

export const gtagPageView = (pathname) => {
Expand Down

0 comments on commit c27bcac

Please sign in to comment.