diff --git a/cordova-app/GoogleService-Info.plist b/cordova-app/GoogleService-Info.plist
new file mode 100644
index 0000000..511dc32
--- /dev/null
+++ b/cordova-app/GoogleService-Info.plist
@@ -0,0 +1,36 @@
+
+
+
+
+ CLIENT_ID
+ 845679623528-8vm248lavehu6pqcova3vuqhejujgkr6.apps.googleusercontent.com
+ REVERSED_CLIENT_ID
+ com.googleusercontent.apps.845679623528-8vm248lavehu6pqcova3vuqhejujgkr6
+ API_KEY
+ AIzaSyA8HkKbJEp8Yr1J0JnuRcarJIQjYv62i8k
+ GCM_SENDER_ID
+ 845679623528
+ PLIST_VERSION
+ 1
+ BUNDLE_ID
+ com.lewismakesapps.Plastic-Patrol
+ PROJECT_ID
+ plastic-patrol-fd3b3
+ STORAGE_BUCKET
+ plastic-patrol-fd3b3.appspot.com
+ IS_ADS_ENABLED
+
+ IS_ANALYTICS_ENABLED
+
+ IS_APPINVITE_ENABLED
+
+ IS_GCM_ENABLED
+
+ IS_SIGNIN_ENABLED
+
+ GOOGLE_APP_ID
+ 1:845679623528:ios:8201657c241d66c606eadd
+ DATABASE_URL
+ https://plastic-patrol-fd3b3.firebaseio.com
+
+
\ No newline at end of file
diff --git a/cordova-app/config.xml b/cordova-app/config.xml
index 660b90f..917e00c 100644
--- a/cordova-app/config.xml
+++ b/cordova-app/config.xml
@@ -33,6 +33,7 @@
+
@@ -56,6 +57,7 @@
+
diff --git a/cordova-app/google-services.json b/cordova-app/google-services.json
new file mode 100644
index 0000000..312cbeb
--- /dev/null
+++ b/cordova-app/google-services.json
@@ -0,0 +1,47 @@
+{
+ "project_info": {
+ "project_number": "845679623528",
+ "firebase_url": "https://plastic-patrol-fd3b3.firebaseio.com",
+ "project_id": "plastic-patrol-fd3b3",
+ "storage_bucket": "plastic-patrol-fd3b3.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:845679623528:android:42282211c157ffd706eadd",
+ "android_client_info": {
+ "package_name": "uk.co.plasticpatrol"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "845679623528-nvugerce0nloe4e6n8qlqdu1nji07esb.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyBknzfvPiX41dCVvlZV4AF3MpNw7CuacWs"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "845679623528-nvugerce0nloe4e6n8qlqdu1nji07esb.apps.googleusercontent.com",
+ "client_type": 3
+ },
+ {
+ "client_id": "845679623528-8vm248lavehu6pqcova3vuqhejujgkr6.apps.googleusercontent.com",
+ "client_type": 2,
+ "ios_info": {
+ "bundle_id": "com.lewismakesapps.Plastic-Patrol"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
diff --git a/cordova-app/package-lock.json b/cordova-app/package-lock.json
index 5c23071..5ad375f 100644
--- a/cordova-app/package-lock.json
+++ b/cordova-app/package-lock.json
@@ -10,9 +10,9 @@
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
},
"android-versions": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.4.0.tgz",
- "integrity": "sha512-GnomfYsBq+nZh3c3UH/4r9Jt6FuTxdhUJbeHIdYOH5xBhQ8I0ZzC2/RM5IFFIjrzuNWSHb8JWP1lPK0/a26jrg==",
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.5.0.tgz",
+ "integrity": "sha512-/GWUAqa2OJNlDF5VGSe3SR1QMHEPXxx54Ur56r0qQC0H9FlBr7kyBF2SgVEhzFCPbrW4UcYgVuWrq/2Ty3QvXg==",
"requires": {
"semver": "^5.4.1"
}
@@ -22,6 +22,11 @@
"resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz",
"integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE="
},
+ "array-ify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz",
+ "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4="
+ },
"async": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
@@ -39,9 +44,9 @@
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
},
"big-integer": {
- "version": "1.6.44",
- "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.44.tgz",
- "integrity": "sha512-7MzElZPTyJ2fNvBkPxtFQ2fWIkVmuzw41+BZHSzpEq3ymB2MfeKp1+yXl/tS75xCx+WnyV+yb0kp+K1C3UNwmQ=="
+ "version": "1.6.47",
+ "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.47.tgz",
+ "integrity": "sha512-9t9f7X3as2XGX8b52GqG6ox0GvIdM86LyIXASJnDCFhYNgt+A+MByQZ3W2PyMRZjEvG5f8TEbSPfEotVuMJnQg=="
},
"bplist-creator": {
"version": "0.0.7",
@@ -74,22 +79,31 @@
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=",
"dev": true
},
+ "compare-func": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.2.tgz",
+ "integrity": "sha1-md0LpFfh+bxyKxLAjsM+6rMfpkg=",
+ "requires": {
+ "array-ify": "^1.0.0",
+ "dot-prop": "^3.0.0"
+ }
+ },
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"cordova-android": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-8.0.0.tgz",
- "integrity": "sha512-Ipv8HbVJpxEyYFSFLTEOaLRp0yxBtJVNbgSuDEB4naa34FzQaRWSNiiMcPJnO+x3hRXNt7pcwa46hARNzhn7+w==",
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-8.1.0.tgz",
+ "integrity": "sha512-eAY6g9q3raJ4P03wNdSWC5MOW1EfxoomWNXsPhi7T6Q9yAqmxqn0sLEUjLL1Ib0LCH3nKQWBXdxapQ5LgbHu+g==",
"requires": {
- "android-versions": "^1.3.0",
- "cordova-common": "^3.1.0",
- "elementtree": "^0.1.7",
+ "android-versions": "^1.4.0",
+ "compare-func": "^1.3.2",
+ "cordova-common": "^3.2.0",
"nopt": "^4.0.1",
"properties-parser": "^0.3.1",
- "q": "^1.4.1",
+ "q": "^1.5.1",
"shelljs": "^0.5.3"
}
},
@@ -135,20 +149,20 @@
"integrity": "sha512-oHa+SmsMJ4xo4uOgXoQHa7hE0C+I/MSYNxNQYXktVTx8czMpXqV5OnZbTUE/kA4qM/l7XDdxRPeVL8SxIPmA7A=="
},
"cordova-plugin-camera-with-exif": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/cordova-plugin-camera-with-exif/-/cordova-plugin-camera-with-exif-1.3.0.tgz",
- "integrity": "sha512-DTbPQ/Lb3D4dpQoCknm1/h81ONP53hAZiglMgrX6dqMYoUWUTv9Au8OG+TyhbZ5ozrGxfzseokq87jXgkE5Ypw=="
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/cordova-plugin-camera-with-exif/-/cordova-plugin-camera-with-exif-1.3.1.tgz",
+ "integrity": "sha512-R4MeOQ0YI3vKHOc/iGCHcC4xo+t4ziBRG1D1BqaSi2ejtDtEfN+kIcaPC3AEzSJbdzVnN5hFyGZp9hNN067oBw=="
+ },
+ "cordova-plugin-firebase-analytics": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/cordova-plugin-firebase-analytics/-/cordova-plugin-firebase-analytics-3.0.0.tgz",
+ "integrity": "sha512-mwrhEK+65VjfbSrin0DpOq462wj92LFu4TuTLNwEcRZ2UhHVRE1hfVkvOZpV+aBZD9OXAp9Ctio9kBCXC5ALMg=="
},
"cordova-plugin-geolocation": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-geolocation/-/cordova-plugin-geolocation-4.0.2.tgz",
"integrity": "sha512-QGThnPKzPxESHkruZlpE0+5aFBVOet8al0vIJ7laSUOQHIC1dd/JY6peVIbtLboKi5Dap1wCKRubOqPqH8xcQA=="
},
- "cordova-plugin-google-analytics": {
- "version": "1.8.6",
- "resolved": "https://registry.npmjs.org/cordova-plugin-google-analytics/-/cordova-plugin-google-analytics-1.8.6.tgz",
- "integrity": "sha512-shg8e3ris1MzmhC8roraScc2GEcfe7sVlbKkvrO3wZUAlYr31sf+4wxZr/VQB6tEcPsmTAkoNjGr1zMwoYjMeg=="
- },
"cordova-plugin-splashscreen": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-5.0.3.tgz",
@@ -164,6 +178,16 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.4.tgz",
"integrity": "sha512-EYC5eQFVkoYXq39l7tYKE6lEjHJ04mvTmKXxGL7quHLdFPfJMNzru/UYpn92AOfpl3PQaZmou78C7EgmFOwFQQ=="
},
+ "cordova-support-android-plugin": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/cordova-support-android-plugin/-/cordova-support-android-plugin-1.0.1.tgz",
+ "integrity": "sha512-m/ciZFl2kPsdA1jFp0By2txF0aOqnVvhNqQhM04fFNjD2tlcFNsaIqOpkCfDzCYVy9mVH0BupwePmRMTgEIoMw=="
+ },
+ "cordova-support-google-services": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/cordova-support-google-services/-/cordova-support-google-services-1.3.1.tgz",
+ "integrity": "sha512-YbFWYBSkbErZh/moothPZG/p1p79ytXTc0iR4YHypBXg9TSDp7M7wm5eKk0f6wV4Ugv6a7UgBvAEtq2nllI8UA=="
+ },
"corser": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
@@ -214,6 +238,14 @@
"resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz",
"integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM="
},
+ "dot-prop": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-3.0.0.tgz",
+ "integrity": "sha1-G3CK8JSknJoOfbyteQq6U52sEXc=",
+ "requires": {
+ "is-obj": "^1.0.0"
+ }
+ },
"ecstatic": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.2.tgz",
@@ -245,16 +277,20 @@
}
},
"es-abstract": {
- "version": "1.13.0",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz",
- "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==",
+ "version": "1.15.0",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.15.0.tgz",
+ "integrity": "sha512-bhkEqWJ2t2lMeaJDuk7okMkJWI/yqgH/EoGwpcvv0XW9RWQsRspI4wt6xuyuvMvvQE3gg/D9HXppgk21w78GyQ==",
"requires": {
"es-to-primitive": "^1.2.0",
"function-bind": "^1.1.1",
"has": "^1.0.3",
+ "has-symbols": "^1.0.0",
"is-callable": "^1.1.4",
"is-regex": "^1.0.4",
- "object-keys": "^1.0.12"
+ "object-inspect": "^1.6.0",
+ "object-keys": "^1.1.1",
+ "string.prototype.trimleft": "^2.1.0",
+ "string.prototype.trimright": "^2.1.0"
}
},
"es-to-primitive": {
@@ -429,6 +465,11 @@
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY="
},
+ "is-obj": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
+ "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8="
+ },
"is-regex": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
@@ -751,6 +792,24 @@
"function-bind": "^1.0.2"
}
},
+ "string.prototype.trimleft": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
+ "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==",
+ "requires": {
+ "define-properties": "^1.1.3",
+ "function-bind": "^1.1.1"
+ }
+ },
+ "string.prototype.trimright": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz",
+ "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==",
+ "requires": {
+ "define-properties": "^1.1.3",
+ "function-bind": "^1.1.1"
+ }
+ },
"strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
diff --git a/cordova-app/package.json b/cordova-app/package.json
index bd3e1c7..469dae1 100644
--- a/cordova-app/package.json
+++ b/cordova-app/package.json
@@ -5,31 +5,34 @@
"homepage": "./",
"cordova": {
"platforms": [
- "ios",
- "android"
+ "android",
+ "ios"
],
"plugins": {
"cordova-plugin-whitelist": {},
- "cordova-plugin-camera-with-exif": {},
"cordova-plugin-geolocation": {},
- "cordova-plugin-google-analytics": {},
"cordova-plugin-splashscreen": {},
- "cordova-plugin-statusbar": {}
+ "cordova-plugin-statusbar": {},
+ "cordova-plugin-camera-with-exif": {
+ "ANDROID_SUPPORT_V4_VERSION": "27.+"
+ }
}
},
"dependencies": {
- "cordova-android": "^8.0.0",
+ "cordova-android": "^8.1.0",
"cordova-ios": "^5.0.1",
"cordova-ios-plugin-no-export-compliance": "0.0.5",
- "cordova-plugin-camera-with-exif": "^1.2.7",
+ "cordova-plugin-camera-with-exif": "^1.3.1",
+ "cordova-plugin-firebase-analytics": "^3.0.0",
"cordova-plugin-geolocation": "^4.0.1",
- "cordova-plugin-google-analytics": "^1.8.6",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
- "cordova-plugin-whitelist": "^1.3.4"
+ "cordova-plugin-whitelist": "^1.3.4",
+ "cordova-support-android-plugin": "^1.0.1",
+ "cordova-support-google-services": "^1.3.1"
},
"devDependencies": {
"http-server": "^0.11.1",
"xmldom": "^0.1.27"
}
-}
+}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 3f5d347..d0d1c20 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20120,11 +20120,6 @@
"firebaseui": "^4.1.0"
}
},
- "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-input-autosize": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-2.2.2.tgz",
diff --git a/package.json b/package.json
index 6d8409c..12eee8a 100755
--- a/package.json
+++ b/package.json
@@ -20,7 +20,6 @@
"react": "^16.10.1",
"react-dom": "^16.10.1",
"react-firebaseui": "^4.0.0",
- "react-ga": "^2.5.6",
"react-router-dom": "^5.1.2",
"react-select": "^3.0.8",
"react-swipe": "^6.0.4"
diff --git a/src/custom/config.json b/src/custom/config.json
index a43f52e..d125419 100644
--- a/src/custom/config.json
+++ b/src/custom/config.json
@@ -6,7 +6,8 @@
"projectId": "plastic-patrol-fd3b3",
"storageBucket": "plastic-patrol-fd3b3.appspot.com",
"messagingSenderId": "845679623528",
- "appId": "1:845679623528:web:11731eae5c93b758"
+ "appId": "1:845679623528:web:11731eae5c93b758",
+ "measurementId": "G-E3JL8LTHS9"
},
"metadata": {
"metadataServerUrl": "https://md.plasticpatrol.co.uk",
diff --git a/src/firebaseInit.js b/src/firebaseInit.js
index db54f9c..e048133 100644
--- a/src/firebaseInit.js
+++ b/src/firebaseInit.js
@@ -7,6 +7,7 @@ import "firebase/performance";
// import 'firebase/messaging';
// import 'firebase/functions';
import "firebase/storage";
+import "firebase/analytics";
import config from './custom/config'
// Initialize Firebase
diff --git a/src/gtag.js b/src/gtag.js
index 9653cfc..abc2247 100644
--- a/src/gtag.js
+++ b/src/gtag.js
@@ -1,101 +1,51 @@
-import config from './custom/config';
+import firebase from "firebase/app";
+
+let analytics;
export const gtagInit = () => {
if (window.cordova) {
- 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("/#/");
+ analytics = window.cordova.plugins.firebase.analytics;
+ analytics.logEvent("type", {
+ event_category: "Tech",
+ event_label: "mobile",
+ non_interaction: true
+ });
+ } else {
+ analytics = firebase.analytics();
+ analytics.logEvent("type", {
+ event_category: "Tech",
+ event_label: "web",
+ non_interaction: true
});
}
- else{
- 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());
-
- // this is the new analytics
- gtag("config", config.GA_PROPERTY_ID, {
- page_path: "/#/"
- });
-
- // it will phased out
- gtag("config", config.GA_TRACKING_ID, {
- page_path: "/#/"
- });
- gtag("event", "app version", {
- event_category: "Tech",
- event_label: process.env.REACT_APP_VERSION,
- non_interaction: true
- });
+ analytics.setCurrentScreen("/#");
- gtag("event", "build number", {
- event_category: "Tech",
- event_label: process.env.REACT_APP_BUILD_NUMBER,
- non_interaction: true
- });
+ analytics.logEvent('app version', {
+ event_category: "Tech",
+ event_label: process.env.REACT_APP_VERSION,
+ non_interaction: true
+ });
- gtag("event", "type", {
- event_category: "Tech",
- event_label: "web",
- non_interaction: true
- });
- }
-}
+ analytics.logEvent("build number", {
+ event_category: "Tech",
+ event_label: process.env.REACT_APP_BUILD_NUMBER,
+ non_interaction: true
+ });
+};
export const gtagPageView = (pathname) => {
- if (window.cordova) {
- window.ga.trackView('/#' + pathname);
- }
- else{
- gtag("config", config.GA_PROPERTY_ID, {
- page_path: "/#" + pathname
- });
-
- gtag('config', config.GA_TRACKING_ID, {
- 'page_path' : '/#' + pathname
- });
- }
-}
+ analytics.setCurrentScreen("/#" + pathname)
+};
-export const gtagEvent = (action,category=null, label=null,non_interaction=false) => {
- if (window.cordova) {
- window.ga.trackEvent(category,action,label);
- }
- else{
- gtag('event', action, {
+export const gtagEvent = (name, category=null, label=null,non_interaction=false) => {
+ analytics.logEvent( name, {
'event_category' : category,
'event_label' : label,
'non_interaction': non_interaction
});
- }
-}
+};
export const gtagSetId = (id) => {
- if (window.cordova) {
- window.ga.setUserId(id);
- }
- else{
- gtag('set', {
- 'userId' : id,
- });
- }
-}
-
-window.dataLayer = window.dataLayer || [];
-function gtag(){window.dataLayer.push(arguments);}
-
-export default gtag;
+ analytics.setUserId(id)
+};