fix: disable countly in dev mode

This commit is contained in:
João Peixoto committed 2021-04-08 01:32:55 +01:00
1 parent d75ff3e53e
commit 55b1baff03
2 files changed
+12 -10

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ export default ({ Vue, router, siteData, isServer }) => {
return originalPush.call(this, location)
}
if (!isServer) {
if (!isServer && process.env.NODE_ENV === 'production') {
// track page view via Countly when route changes
router.afterEach((to) => {
if (!window.Countly) return
+11 -9
View File
@@ -44,15 +44,17 @@ export function loadScript() {
Track an event to countly with the provided data
*/
export function trackEvent(event, data = {}) {
// console.info('[countly]', 'trackEvent()', event, data)
window.Countly.q.push([
'add_event',
{
key: event,
segmentation: data,
},
])
if (process.env.NODE_ENV === 'production') {
window.Countly.q.push([
'add_event',
{
key: event,
segmentation: data,
},
])
} else {
console.info('[countly]', 'trackEvent()', event, data)
}
}
export default {