Commit d0f518dd authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Actualiza a Google Analytics 4, ID y código

parent c654ebc2
Loading
Loading
Loading
Loading
+19 −15
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ define([
			this._onCookiesAcceptedHandler && this._onCookiesAcceptedHandler.remove();
			this._cookiesNotificationHandler && this._cookiesNotificationHandler.dismiss();

			if (window.location.hostname.indexOf("redmic.es") > -1) {
			if (window.location.hostname.indexOf('redmic.es') !== -1) {
				this._googleAnalytics();
			}
		},
@@ -102,22 +102,26 @@ define([
			//	tags:
			//		private

			(function(i,s,o,g,r,a,m) {
				i.GoogleAnalyticsObject = r;
			var script = document.createElement('script'),
				gtagId = redmicConfig.googleAnalyticsId;

				i[r] = i[r] || function() {
					(i[r].q = i[r].q || []).push(arguments);
			script.async = false;
			script.src = 'https://www.googletagmanager.com/gtag/js?id=' + gtagId;

			script.onload = function() {

				window.dataLayer = [];

				window.gtag = function() {

					dataLayer.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', redmicConfig.googleAnalyticsId, 'auto');
			ga('send', 'pageview');

				gtag('js', new Date());
				gtag('config', gtagId);
			};

			document.head.appendChild(script);
		}
	});
});
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ define([], function() {
		'oauthClientId': 'app',
		'siteKeyReCaptcha': '6LfA6_0SAAAAACT3i8poH1NqztZCtIW1OahT0cXs',
		'siteKeyForDebugReCaptcha': '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI',
		'googleAnalyticsId': 'UA-58848624-1'
		'googleAnalyticsId': 'G-J753HC86F0'
	};

	retObj.viewPaths = {
+16 −8
Original line number Diff line number Diff line
@@ -191,6 +191,11 @@ define([
			this._publish(channel);
		},

		_gtagIsAvailable: function() {

			return typeof gtag !== 'undefined';
		},

		_trackPageView: function(/*Object*/ pageInfo) {
			//	summary:
			//		Permite trakear una página vista en google analytics
@@ -200,8 +205,8 @@ define([
			//		Puede ser un string con la url de la página o un objeto con más información
			//		pj. page, title, version...

			if (typeof ga != "undefined") {
				ga('send', 'pageview', pageInfo);
			if (this._gtagIsAvailable()) {
				gtag('event', 'page_view', pageInfo);
			}
		},

@@ -220,9 +225,12 @@ define([
			//		Valor del evento
			//	** label y value son opcionales

			if (typeof ga != "undefined") {
				ga('send', 'event',
					eventInfo.category, eventInfo.action, eventInfo.label, eventInfo.value);
			if (this._gtagIsAvailable()) {
				gtag('event', eventInfo.action, {
					event_category: eventInfo.category,
					event_label: eventInfo.label,
					value: eventInfo.value
				});
			}
		},

@@ -234,8 +242,8 @@ define([
			//	exceptionInfo
			//		Objecto con información de la excepción. ej: exDescription, exFatal(boolen)...

			if (typeof ga != "undefined") {
				ga('send', 'exception', exceptionInfo);
			if (this._gtagIsAvailable()) {
				gtag('event', 'exception', exceptionInfo);
			}
		}
	});