From 865f0aa3f542ae79a5596888d9cdccee082c878a Mon Sep 17 00:00:00 2001 From: saladgg Date: Fri, 9 Sep 2022 15:55:55 +0300 Subject: [PATCH 1/3] chore: add google analytics for user metrics collection --- assets/static/js/project.js | 34 -------------------------------- assets/templates/atoms/head.html | 15 +++++++++++++- 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/assets/static/js/project.js b/assets/static/js/project.js index 1ae95fb..12e6017 100644 --- a/assets/static/js/project.js +++ b/assets/static/js/project.js @@ -33,37 +33,3 @@ function switchDashboards(event) { // Hide the menu after selection $("#accordionSidebar.toggled #dashboards-menu").removeClass("show"); } - - -(function($) { - /* Google Analytics */ - window.dataLayer = window.dataLayer || []; - - function gtag() { - dataLayer.push(arguments); - } - gtag("js", new Date()); - gtag("config", "G-WW2W29ZMTZ"); - - // Auto-collapse open menus in responsive mode - $(".navbar-collapse a").click(function() { - $(".navbar-collapse").collapse("hide"); - }); - - // Initialize the select2 plugin - $("select").each(function() { - $(this).select2({ - allowClear: typeof $(this).data("allow-clear") !== "undefined" ? Boolean($(this).data("allow-clear")) : Boolean($(this).attr("multiple")), - closeOnSelect: !$(this).attr("multiple"), - placeholder: typeof $(this).data("placeholder") !== "undefined" ? $(this).data("placeholder") : {"id": `select2__placeholder__id__{$(this).attr('id')}`, "placeholder": `Select ${getElementLabelText(this)}`}, - theme: "bootstrap4", - width: $(this).data("width") ? $(this).data("width") : $(this).hasClass("w-100") ? "100%" : "resolve", - }); - }); - - // Initialize the date picker plugin - $(".datepicker").datepicker(); - - // Add a dashboard selection change listener - $("#dashboards-menu > div > a").click(switchDashboards); -})(jQuery); diff --git a/assets/templates/atoms/head.html b/assets/templates/atoms/head.html index cd79179..284bb03 100644 --- a/assets/templates/atoms/head.html +++ b/assets/templates/atoms/head.html @@ -35,7 +35,20 @@ {% endcompress %} - + {% endblock javascript %} + + + + + + + From ed50a71d49ac0ba9abfce866f0b0cb580640e44d Mon Sep 17 00:00:00 2001 From: saladgg Date: Mon, 12 Sep 2022 11:07:31 +0300 Subject: [PATCH 2/3] chore: add google analytics for user metrics collection --- assets/static/js/project.js | 34 ++++++++++++++++++++++++++++++++ assets/templates/atoms/head.html | 15 +++----------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/assets/static/js/project.js b/assets/static/js/project.js index 12e6017..938040c 100644 --- a/assets/static/js/project.js +++ b/assets/static/js/project.js @@ -33,3 +33,37 @@ function switchDashboards(event) { // Hide the menu after selection $("#accordionSidebar.toggled #dashboards-menu").removeClass("show"); } + + +(function($) { + /* Google Analytics */ + window.dataLayer = window.dataLayer || []; + + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + gtag('config', 'G-S5JLWM36RQ'); + + // Auto-collapse open menus in responsive mode + $(".navbar-collapse a").click(function() { + $(".navbar-collapse").collapse("hide"); + }); + + // Initialize the select2 plugin + $("select").each(function() { + $(this).select2({ + allowClear: typeof $(this).data("allow-clear") !== "undefined" ? Boolean($(this).data("allow-clear")) : Boolean($(this).attr("multiple")), + closeOnSelect: !$(this).attr("multiple"), + placeholder: typeof $(this).data("placeholder") !== "undefined" ? $(this).data("placeholder") : {"id": `select2__placeholder__id__{$(this).attr('id')}`, "placeholder": `Select ${getElementLabelText(this)}`}, + theme: "bootstrap4", + width: $(this).data("width") ? $(this).data("width") : $(this).hasClass("w-100") ? "100%" : "resolve", + }); + }); + + // Initialize the date picker plugin + $(".datepicker").datepicker(); + + // Add a dashboard selection change listener + $("#dashboards-menu > div > a").click(switchDashboards); +})(jQuery); diff --git a/assets/templates/atoms/head.html b/assets/templates/atoms/head.html index 284bb03..34759f5 100644 --- a/assets/templates/atoms/head.html +++ b/assets/templates/atoms/head.html @@ -29,6 +29,7 @@ {% endblock css %} + {% block javascript %} {% compress js %} @@ -36,19 +37,9 @@ {% endcompress %} - - {% endblock javascript %} - - - - + + {% endblock javascript %} From 6b894b666c75ef589ea85f8715b310ce7fd1e0cd Mon Sep 17 00:00:00 2001 From: saladgg Date: Mon, 12 Sep 2022 13:13:44 +0300 Subject: [PATCH 3/3] chore: add google analytics for user metrics --- assets/static/js/project.js | 9 +++------ assets/templates/atoms/head.html | 5 +++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/assets/static/js/project.js b/assets/static/js/project.js index 938040c..e20da3e 100644 --- a/assets/static/js/project.js +++ b/assets/static/js/project.js @@ -36,14 +36,11 @@ function switchDashboards(event) { (function($) { - /* Google Analytics */ + /* Google Analytics */ window.dataLayer = window.dataLayer || []; - - function gtag() { - dataLayer.push(arguments); - } + function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); - gtag('config', 'G-S5JLWM36RQ'); + gtag('config', 'G-6XRLBC4TMR'); // Auto-collapse open menus in responsive mode $(".navbar-collapse a").click(function() { diff --git a/assets/templates/atoms/head.html b/assets/templates/atoms/head.html index 34759f5..3f650d3 100644 --- a/assets/templates/atoms/head.html +++ b/assets/templates/atoms/head.html @@ -37,9 +37,10 @@ {% endcompress %} - - + + + {% endblock javascript %}