if(document.querySelector('[data-script="autoOptimizescript"]')==null) { var optimizeUrl = new URL(window.location.href); var optimizeMode = (optimizeUrl.searchParams.get("ao_mode")!=null) ? optimizeUrl.searchParams.get("ao_mode") : ''; var project_id = (optimizeUrl.searchParams.get("ao_realProjectId")!=null) ? optimizeUrl.searchParams.get("ao_realProjectId") : 0; var $_COOKIE = document.cookie; var $_RELOAD_COOKIE = false; var optimizeScripturl = new URL(document.currentScript.src); var OPTIMIZE_API_URL = "https://app.autooptimize.ai/"; console.log("DEBUG API URL", optimizeScripturl); console.log("OPTIMIZE_API_URL", OPTIMIZE_API_URL); var ELEMENT_AO_ID_VS_HASH_MAPPING={}; if(document.currentScript.getAttribute('data-launch') != undefined){ optimizeMode="edit"; } if(optimizeMode=="edit"){ window.__lo_site_id = 222137; (function() { var wa = document.createElement('script'); wa.type = 'text/javascript'; wa.async = true; wa.src = 'https://d10lpsik1i8c69.cloudfront.net/w.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wa, s); window._loq = window._loq || []; window._loq.push(["tag", "unknownUser"]); })(); if(project_id != 0){ callAPIOld(OPTIMIZE_API_URL+'/api/projects/get-intercom-details/'+project_id); (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/xc39jsxs';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})(); } else { callAPI(OPTIMIZE_API_URL+'projects/get-intercom-details'); (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/xc39jsxs';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})(); } optimizeScripturl="https://cdn.autooptimize.ai/js/ExperimentPreview.js"; } else { var USERDATA = "{\"projects\":{\"eyJpdiI6IlBBZ000Q3JQTzhsbXlyem1ZT2ZUdVE9PSIsInZhbHVlIjoiMlN2cHFjQ2hEMkJocWd6S0tERW50Zz09IiwibWFjIjoiZGFiZWI5Yjk4YjY1Y2Q4NjdiOTQ0NjVjY2I3NjgyM2JmNTM3NjYwZWY5ZWVmNDU1MDQzZTU4ZDg3M2NhYTk1NCJ9\":{\"url\":\"https:\\/\\/damasoribeiro.pt\\/\",\"projectId\":\"eyJpdiI6IlBBZ000Q3JQTzhsbXlyem1ZT2ZUdVE9PSIsInZhbHVlIjoiMlN2cHFjQ2hEMkJocWd6S0tERW50Zz09IiwibWFjIjoiZGFiZWI5Yjk4YjY1Y2Q4NjdiOTQ0NjVjY2I3NjgyM2JmNTM3NjYwZWY5ZWVmNDU1MDQzZTU4ZDg3M2NhYTk1NCJ9\",\"intercomData\":{\"hasIntercom\":true,\"app_id\":\"xc39jsxs\",\"name\":\"Damaso Ribeiro\",\"email\":\"dacrib1971@gmail.com\",\"created_at\":1594752827,\"show_tour\":1},\"watermark\":1,\"base_url\":\"https:\\/\\/app.autooptimize.ai\",\"experimentData\":{\"project\":{\"id\":22257,\"user_id\":1077,\"name\":\"E-commerce through Affiliate Marketing\",\"url\":\"https:\\/\\/damasoribeiro.pt\\/\",\"success_url\":\"test\",\"success_url_type\":1,\"traffic_percent\":99,\"success_percent\":100,\"improvement\":null,\"page_type\":3,\"custom_page_type\":null,\"product_type\":2,\"custom_product_type\":null,\"industry\":null,\"language\":40,\"status\":4,\"funnel_id\":null,\"created_at\":\"2020-07-18 08:17:09\",\"updated_at\":\"2020-07-22 18:46:04\",\"step_id\":null,\"page_original_id\":null,\"page_variation_id\":null,\"code_added_flag\":1,\"meta_tag_content\":null,\"email_subscription\":\"true\",\"last_cron_run_time\":\"2020-07-21 08:41:06\",\"new_project\":\"1\",\"experiment_data\":\"{\\\"mapElements\\\":[],\\\"experiments\\\":[],\\\"hashMapping\\\":[],\\\"lastDataOptimizeNumber\\\":0}\",\"new_experiments\":null,\"setup_flag\":1,\"pause_flag\":0,\"last_stats_run_time\":null,\"minimum_visitor\":100,\"project_experiments\":[],\"user\":{\"id\":1077,\"encrypted_id\":\"eyJpdiI6InFHb3ZpNzJlaGlQaEtOR3lZWWswV1E9PSIsInZhbHVlIjoic3FwUWFTZlNIMkpuMGZ5V2ZVR0lCUT09IiwibWFjIjoiYWM1ZWMzZTExYzBlZDk3ODc1ODQ5ZGU1OWYyMzMxOWRmOWViYjYwMTU0ODUzNDQ0NDliNWJhZGU4M2VmYjJiYSJ9\",\"email\":\"dacrib1971@gmail.com\",\"job_title\":14,\"other_job_title\":null,\"type\":1,\"username\":\"Damaso Ribeiro\",\"first_name\":\"Damaso\",\"last_name\":\"Ribeiro\",\"status_button\":\"not\",\"watermark\":1,\"show_tour\":1,\"tour_data\":\"{\\\"a\\\":\\\"true\\\",\\\"b\\\":\\\"true\\\",\\\"c\\\":\\\"false\\\",\\\"d\\\":true,\\\"e\\\":\\\"false\\\",\\\"f\\\":\\\"false\\\",\\\"g\\\":\\\"false\\\"}\",\"user_timezone\":\"Europe\\/Lisbon\",\"plan_status\":null,\"active_status\":0,\"beta_user\":1,\"recurly_uuid\":null,\"recurly_account\":null,\"current_plan\":null,\"minimum_visitor\":100,\"mail_90_visit\":null,\"activation_token\":\"uRs1zOcyTLLUPwFXa1pHCXRx7iFWIwwhDII8qtMALqRp5h0ul0hi3agfubes\",\"passwordResetToken\":null,\"subscription_expire\":null,\"subscription_cancel\":null,\"stripe_id\":null,\"card_last_four\":null,\"stripe_access_token\":null,\"stripe_user_id\":null,\"stripe_refresh_token\":null,\"login_token\":null,\"notification_seen_at\":null,\"watched_video_flag\":0,\"created_at\":\"2020-07-14 18:53:47\",\"updated_at\":\"2020-09-05 08:17:35\"}},\"url\":\"https:\\/\\/damasoribeiro.pt\\/\",\"elementsTypes\":[{\"id\":20,\"name\":\"Headline\",\"slug\":\"headline\",\"selector\":null,\"new_element\":1,\"created_at\":\"2019-03-26 20:52:05\",\"updated_at\":\"2019-03-26 20:52:05\",\"description\":\"The headline on the page explaining the main offer. Usually just one.\",\"platform_experiment\":[{\"id\":2,\"element_type_id\":20,\"experiment_no\":2,\"title\":\"Different headline\",\"description\":\"Different headline\",\"impact\":\"normal\",\"question\":\"Please enter different headline options.\"}]},{\"id\":21,\"name\":\"Subheadline\",\"slug\":\"sub_headline\",\"selector\":null,\"new_element\":1,\"created_at\":\"2019-03-26 20:52:05\",\"updated_at\":\"2019-03-26 20:52:05\",\"description\":\"The subheadline on the page explaining the headline better. Usually just one.\",\"platform_experiment\":[{\"id\":3,\"element_type_id\":21,\"experiment_no\":null,\"title\":\"Red sub headline\",\"description\":\"Red sub headline\",\"impact\":\"normal\",\"question\":\"Please enter different sub headline options.\"}]},{\"id\":22,\"name\":\"Logo\",\"slug\":\"logo\",\"selector\":null,\"new_element\":1,\"created_at\":null,\"updated_at\":null,\"description\":\"This is your logo image\",\"platform_experiment\":[]},{\"id\":23,\"name\":\"Sales\\/Demo Video\",\"slug\":\"sales_video\",\"selector\":null,\"new_element\":1,\"created_at\":null,\"updated_at\":null,\"description\":\"This is the main sales or demo video on the page explaining your offer\\/business. Usually just one.\",\"platform_experiment\":[{\"id\":1,\"element_type_id\":23,\"experiment_no\":51,\"title\":\"Hide everything until visitors watch at least half the video\",\"description\":\"Hide everything until visitors watch at least half the video\",\"impact\":\"normal\",\"question\":\"Please enter video url\"}]},{\"id\":24,\"name\":\"Signup button\",\"slug\":\"signup_button\",\"selector\":null,\"new_element\":1,\"created_at\":\"2020-05-31 00:00:00\",\"updated_at\":null,\"description\":\"A signup button that signs people up to something for free. It can be a free trial, or a newsletter, or anything, so long as it's free. This is different from an Add-To-Cart button or an Order button. \",\"platform_experiment\":[]},{\"id\":25,\"name\":\"Add-To-Cart button\",\"slug\":\"add_to_cart_button\",\"selector\":null,\"new_element\":1,\"created_at\":null,\"updated_at\":null,\"description\":\"A button that adds an item to a shopping cart. Different from a Signup button or an Order button.\",\"platform_experiment\":[]},{\"id\":26,\"name\":\"Order button\",\"slug\":\"order_buttton\",\"selector\":null,\"new_element\":1,\"created_at\":null,\"updated_at\":null,\"description\":\"A button that finalizes an order or a button that starts the order process for something where the user has to pay. \",\"platform_experiment\":[]},{\"id\":28,\"name\":\"Navigation bar\",\"slug\":\"navigation_bar\",\"selector\":null,\"new_element\":1,\"created_at\":null,\"updated_at\":null,\"description\":\"This is your navigation bar with links to various pages on your website. Select the entire navigation bar with all the links inside it. Try not to select other things like logos or call-to-action buttons that may also be found in your header, just the navigation bar.\",\"platform_experiment\":[]}],\"pricingExperiments\":[],\"selectedExperimentsIds\":[],\"newExperiment\":[]}}},\"experiments\":{\"eyJpdiI6IlBBZ000Q3JQTzhsbXlyem1ZT2ZUdVE9PSIsInZhbHVlIjoiMlN2cHFjQ2hEMkJocWd6S0tERW50Zz09IiwibWFjIjoiZGFiZWI5Yjk4YjY1Y2Q4NjdiOTQ0NjVjY2I3NjgyM2JmNTM3NjYwZWY5ZWVmNDU1MDQzZTU4ZDg3M2NhYTk1NCJ9\":{\"experimentsData\":[]}}}"; optimizeScripturl="https://cdn.autooptimize.ai/js/ExperimentLive.js"; } var script = document.createElement('script'); script.type = "text/javascript"; script.src = optimizeScripturl; script.setAttribute('data-script',"autoOptimizescript"); script.setAttribute('test-mode',"true"); script.setAttribute('data-userid',"eyJpdiI6InFHb3ZpNzJlaGlQaEtOR3lZWWswV1E9PSIsInZhbHVlIjoic3FwUWFTZlNIMkpuMGZ5V2ZVR0lCUT09IiwibWFjIjoiYWM1ZWMzZTExYzBlZDk3ODc1ODQ5ZGU1OWYyMzMxOWRmOWViYjYwMTU0ODUzNDQ0NDliNWJhZGU4M2VmYjJiYSJ9"); if(document.currentScript.getAttribute('data-launch') != undefined){ script.setAttribute('data-launch',"yes"); } document.getElementsByTagName('head')[0].appendChild(script); var link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'; document.getElementsByTagName('head')[0].appendChild(link); var refreshCookieInterval = setInterval(() => { if ($_RELOAD_COOKIE) { $_RELOAD_COOKIE = false; $_COOKIE = document.cookie; } }, 20); function callAPI(url) { const response = fetch(url); response.then(function (a) { return a.json(); // call the json method on the response to get JSON }) .then(function(data) { if(data.hasIntercom == true ){ window.intercomSettings = { app_id: data.app_id, created_at: data.created_at, email: data.email, name: data.name }; window.show_tour = data.show_tour; if(data.tour_data == null || data.tour_data == ''){ window.tourData = '{"a":false,"b":false,"c":false,"d":false,"e":false,"f":false,"g":false}'; } else { window.tourData = data.tour_data; } } }).catch(function (err) { console.log('none'); }) } function callAPIOld(url) { const response = fetch(url); response.then(function (a) { return a.json(); // call the json method on the response to get JSON }) .then(function(data) { if(data.hasIntercom == true ){ window.intercomSettings = { app_id: data.app_id, created_at: data.created_at, email: data.email, name: data.name }; window.show_tour = data.show_tour; } }) } }