1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Add Google Analytics to client portal pages if tracking ID is implemented

This commit is contained in:
David Bomba 2022-02-17 09:13:14 +11:00
parent 41b6e8befa
commit 20f2c3acd7

View File

@ -122,6 +122,31 @@
})}
);
</script>
@if($company && $company->google_analytics_key)
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', '{{ $company->google_analytics_key }}', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
function trackEvent(category, action) {
ga('send', 'event', category, action, this.src);
}
</script>
@endif
</body>
<footer>