This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new 640c509  [OPENMEETINGS-2472] gtag should work
640c509 is described below

commit 640c50916a7b5c3da9c775597e0309887b3bc42d
Author: Maxim Solodovnik <solomax...@gmail.com>
AuthorDate: Sun Oct 4 12:57:53 2020 +0700

    [OPENMEETINGS-2472] gtag should work
---
 .../java/org/apache/openmeetings/web/pages/om-ga.js   | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/om-ga.js 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/om-ga.js
index 2e3068d..d1bd241 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/om-ga.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/om-ga.js
@@ -1,12 +1,25 @@
 /* Licensed under the Apache License, Version 2.0 (the "License") 
http://www.apache.org/licenses/LICENSE-2.0 */
 function initGA(code, hash) {
        window.dataLayer = window.dataLayer || [];
-       const gtag = () => dataLayer.push(arguments)
-               , newPage = () => gtag('config', code, {'page_path': 
location.pathname + location.hash});
+       function gtag() {
+               dataLayer.push(arguments);
+       }
+       function newPage() {
+               const page = location.pathname + 
(location.search.indexOf('app=') > -1 ? location.search : location.hash);
+               gtag('config', code, {'page_path': page});
+       }
        gtag('js', new Date());
 
+       gtag('config', code, {
+               anonymize_ip: true
+               , send_page_view: false
+       });
        newPage();
        if (hash) {
-               $(window).off('hashchange').on('hashchange', newPage);
+               $(window).off('hashchange').on('hashchange', () => {
+                       if (location.hash.indexOf('/') > -1) {
+                               newPage();
+                       }
+               });
        }
 }

Reply via email to