Traqueo web actualizado v.3

mail@pastecode.io avatar
unknown
javascript
2 years ago
6.1 kB
3
Indexable
Never

<!-- CONSORCIO.COTIZADOR.TEPUEDEINTERESAR -->


<!-- Global site tag (gtag.js) - Google Ads: 10825956331 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-10825956331"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'AW-10825956331');
</script>



<!-- Facebook  CONSORCIO.COTIZADOR.TEPUEDEINTERESAR  -->
<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', '284884080263394');
  fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
  src="https://www.facebook.com/tr?id=327841712277710&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->









<script>


// https://clientify.net/web-marketing/landingpages/create/steps/4/campaing_CONSORCIOCOTIZADOR_001

(function() {

var $;var n = 0;function init_track_web(n) {			if (typeof jQuery !== 'undefined') {								$ = jQuery;				bindToAjax();						} else if (n < 20) {			n++;			setTimeout(init_track_web, 500);		}}

function bindToAjax() {
				$(document).bind('ajaxComplete', function(evt, jqXhr, opts) {
					var identifier_track = "campaing_CONSORCIOCOTIZADOR_001_27_nov";
					var current_identifier_track = localStorage.getItem(identifier_track);
					if( current_identifier_track == "true"){console.log('ready exists a event track form');return false;}
					if( current_identifier_track == null){console.log('set track event localStorage');localStorage.setItem(identifier_track, 'true');}
					var fullUrl = document.createElement('a');fullUrl.href = opts.url;var pathname = fullUrl.pathname[0] === '/' ? fullUrl.pathname : '/' + fullUrl.pathname;var queryString = fullUrl.search[0] === '?' ? fullUrl.search.slice(1) : fullUrl.search;var queryParameters = objMap(queryString, '&', '=', true);var headers = objMap(jqXhr.getAllResponseHeaders(), '\n', ':');
					var dataAjax = {'event': 'ajaxComplete','attributes': {'type': opts.type || '','url': fullUrl.href || '','queryParameters': queryParameters,'pathname': pathname || '','hostname': fullUrl.hostname || '','protocol': fullUrl.protocol || '','fragment': fullUrl.hash || '','statusCode': jqXhr.status || '','statusText': jqXhr.statusText || '','headers': headers,'timestamp': evt.timeStamp || '','contentType': opts.contentType || '','response': (jqXhr.responseJSON || jqXhr.responseXML || jqXhr.responseText || '')}};
					if( dataAjax.attributes.response.success == true ){console.log('attributes.response.success true');console.info('google init');
						

						
							if(typeof gtag != 'undefined'){
								 gtag('event', 'conversion', {'send_to': 'AW-10825956331/2WBGCMiLqooDEOv3m6oo'});
						       console.info("track Google ads CONSORCIO.COTIZADOR.TEPUEDEINTERESAR");
							}

						

												if(typeof fbq != 'undefined'){
							console.info("track fb");
							fbq('track', 'Lead', {'formulario':'clientify'});
						// fbq('track', 'Contact', {'formulario':'clientify'});
						}else{
							console.info("track fb not defined");
						}
						


					}else{console.log('attributes.response.success false');}console.log(dataAjax);

				});

$(document).ready(function(){	$("[name='phone']").each(function(){		console.info(this);		this.value="+593"	});});
}

setTimeout(init_track_web, 5000);
		function objMap(data, delim, spl, decode) {
				var obj = {};if (!data || !delim || !spl) {return {};}var arr = data.split(delim);var i;
				if (arr) {for (i = 0; i<arr.length; i++) {var item = decode ? decodeURIComponent(arr[i]) : arr[i];var pair = item.split(spl);var key = trim_(pair[0]);var value = trim_(pair[1]);if (key && value) {obj[key] = value;}}}return obj;}
		function trim_(str) {
			if (str) {
				return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
			}
		}
})();












// traqueo de otros eventos
jQuery(document).ready(function(){



jQuery("[href='https://cotizador.condelpi.com/?producto=Tu-Casa']").each(function(){
	jQuery(this).bind('click', function(){
		fbq('trackCustom', 'Tu-Casa', {landing: 'https://cotizador.condelpi.com/?producto=Tu-Casa'});

		<!-- Event snippet for Clic botĆ³n Tu casa conversion page -->
  		gtag('event', 'conversion', {'send_to': 'AW-10825956331/GWEPCMTQ4ooDEOv3m6oo'});


	});
});


jQuery( jQuery("#u_content_button_5")[0].children[0].children[0] ).each(function(){
	jQuery(this).bind('click', function(){
		fbq('trackCustom', 'Tu-Auto-Planificado', {landing: 'https://cotizador.condelpi.com/?producto=Tu-Auto-Planificado'});


		<!-- Event snippet for Clic botĆ³n Tu-Auto-Planificado conversion page -->
		  gtag('event', 'conversion', {'send_to': 'AW-10825956331/mpwUCKiL5YoDEOv3m6oo'});


	});
});



jQuery("[href='https://cotizador.condelpi.com/?producto=Tu-Auto-Programado']").each(function(){
	jQuery(this).bind('click', function(){
		fbq('trackCustom', 'Tu-Auto-Programado', {landing: 'https://cotizador.condelpi.com/?producto=Tu-Auto-Programado'});

  <!-- Event snippet for Clic botĆ³n Tu-Auto-Programado conversion page -->		
  gtag('event', 'conversion', {'send_to': 'AW-10825956331/OJOvCNiR5YoDEOv3m6oo'});



	});
});


jQuery("[href='https://cotizador.condelpi.com/?producto=Tu-Camion-Programado']").each(function(){
	jQuery(this).bind('click', function(){
		fbq('trackCustom', 'Tu-Camion-Programado', {landing: 'https://cotizador.condelpi.com/?producto=Tu-Camion-Programado'});

	  <!-- Event snippet for Clic botĆ³n Tu-Camion-Programado conversion page -->
	  gtag('event', 'conversion', {'send_to': 'AW-10825956331/VGLiCPLwtIoDEOv3m6oo'});

	});
});



});






</script>