ffjs.import(["ouibounce","utm"]); var ff_inputs = { name: ['name'], phone: ['telephone'] }; try { ffjs.vuser('name', document.getElementById('name').value); ffjs.vuser('phone', document.getElementById('telephone').value); ffjs.vuser('email', document.getElementById('email').value); } catch (e) { } if(location.pathname.indexOf('/condominio-') === 0) { ffjs.vprod('pid', location.pathname.substr(1)) } if(location.pathname.indexOf('/condominio-') === 0) { ffjs.vuser('custom[pagina_condominio]', 'sim'); } if(location.pathname.indexOf('/apartamento') === 0) { ffjs.vuser('custom[pagina_apartamento]', 'sim'); } if (location.pathname === "/anunciar-imoveis") { ffjs.vuser('custom[pagina_anunciar_imoveis]', 'sim'); } if (location.pathname === "/plano-contratado") { ffjs.vuser('custom[pagina_plano_contratado]', 'sim'); } function ffShowFrame() { xframe = 'https://static.fulfilling.io/snackbar.html'; ff_iframe = document.createElement('IFRAME'); ff_iframe.src = xframe; ff_iframe.id = 'ffid_ads' ff_iframe.style = "width:350px; height:" + ffidWidth + "px;bottom: 0px;z-index: 100000000;position: fixed;right:0px "; ff_iframe.frameBorder = 0; document.body.appendChild(ff_iframe); } function abcrra(){ if (localStorage) { var email = getEmail(); if (email) { //Envia o lead console.log('s'); lt = leadTelephone(); //Envia o lead em si lt.sendLead(email, $(this).data('user')); $('#phoneToShow_' + $(this).data('uid')).show().removeClass('display-none'); $(this).hide(); } else { ltOpenModal($(this).data('uid')); } } else { ltOpenModal($(this).data('uid')); } } function ffidPopSuccess(page){ var params = [ 'action=success', 'customer_id=' + ffjs.user, 'navigation_id=' + ffjs.trackId, 'page=' + window.location.href, 'type='+ffjs.modalType, 'page_action='+page ]; ffjs.send('popup', params); window.location=page; } var ffidRecomendation = function () { return { universe: $('#track_universe').val(), id: $('#track_product_id').val(), page_type: $('#track_page_type').val(), goal: $('#track_finality').val(), init: function () { }, getApi: function () { var api = null; if (this.id !== undefined) { api = 'https://api.123i.com.br/v1/recommendation/used/' + this.id; if (this.universe === 'anuncio') { return 'https://api.123i.com.br/v1/recommendation/offer/' + this.id; } } console.log('API: ' + api); return api; }, getRecommendation: function () { if (this.page_type === 'listagem') { if ($('#product_id_0')) { this.id = $('#product_id_0').data('id'); } } if (this.goal !== undefined) { this.goal = this.goal.toLowerCase(); } console.log('Tipo: ' + this.page_type); console.log('ID: ' + this.id); var api = this.getApi(); if (api) { $.ajax({ type: "GET", url: api, data: {}, success: function (response) { console.log('Total: ' + response.data.length); if (response.data.length > 0) { $('.ffid-mod-title').html('Já vai?! Veja estas oportunidades. Clique e saiba mais'); var htmlString = ''; response.data.forEach(function (value, index) { htmlString += '
'; htmlString += '
'; htmlString += ''; htmlString += '
' + value.title + ''; htmlString += '
' + value.description + ''; htmlString += '
Saiba mais'; htmlString += '
'; htmlString += '
'; htmlString += '
'; }); htmlString += ''; $('#ffidModBody').html(htmlString); } } }); } }, } } var ffRecomendation = ffidRecomendation(); ffRecomendation.getRecommendation(); setTimeout(function(){ console.log('Busca recomendacao'); var ffRecomendation = ffidRecomendation(); ffRecomendation.getRecommendation(); },40000); if(!localStorage.getItem('ffidAbandono40segundos')){ console.log('Dispara após 40 segundos'); setTimeout(function(){ _ouibounce.open(); localStorage.setItem('ffidAbandono40segundos',1); },40000); }