From 5776def861651ff2529ee970aaaa6532fa841afa Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 6 May 2020 00:22:02 +0300 Subject: [PATCH] owa tracking half working initial page load is accurate but then subsequent navigation registers the event as originating not from the destination page but the current page. --- app/app.html | 23 +++++++++++++++++++++++ app/plugins/owa.js | 22 ++++------------------ 2 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 app/app.html diff --git a/app/app.html b/app/app.html new file mode 100644 index 0000000..a34c85b --- /dev/null +++ b/app/app.html @@ -0,0 +1,23 @@ + + + + {{ HEAD }} + + + {{ APP }} + + + diff --git a/app/plugins/owa.js b/app/plugins/owa.js index e7d0b3b..6549f40 100644 --- a/app/plugins/owa.js +++ b/app/plugins/owa.js @@ -1,26 +1,12 @@ /* eslint-disable */ export default ({ app }) => { - /* - * ** Only run on client-side and only in production mode - * */ if (process.env.NODE_ENV !== 'production') return - var owa_baseUrl = 'https://owa.isnet.uk/'; - var owa_cmds = owa_cmds || []; - owa_cmds.push(['setSiteId', '0c3a9f11563be70da80f493a590b46d1']); - - (function() { - var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true; - owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl ); - _owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js'; - var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s); - }()); - /* - * ** Every time the route changes (fired on initialization too) - * */ app.router.afterEach((to, from) => { - owa_cmds.push(['trackPageView']); - owa_cmds.push(['trackClicks']); + if (window.owa_cmds) { + window.owa_cmds.push(['trackPageView']); + window.owa_cmds.push(['trackClicks']); + } }) }