// 1. Create the container var qc_container = document.createElement( 'div' ); qc_container.id = 'qc-container'; document.body.appendChild( qc_container ); var widget_script = ''; var origin_url = window.document.location.origin; // 2. Create a iframe to load the react App var qc_iframe = document.createElement( 'iframe' ); qc_iframe.id = 'qc-frame'; // position: fixed; remove a white space which was added at the bottom of the page qc_iframe.style.position = 'fixed'; // Cannot use display: none; otherwise the autogrow textarea will not work qc_iframe.style.visibility = 'hidden'; document.body.appendChild( qc_iframe ); qc_iframe.contentWindow.document.write( '' + widget_script + '' ); qc_iframe.contentWindow.document.close(); qc_iframe.contentWindow.context = { baseUrl: 'https://onelocal.com', environment: 'production', merchantId: '5e4fe41568ff9b1ba2bdd7f4', merchantName: 'Call the Plumbing Doctor Inc.', originUrl: origin_url, sentry: 'https://ec0b927b3ee742b1ac32f546edbe3cad@app.getsentry.com/20033', widgetSettings: {"hipaa_enabled":false,"intro":{"enabled":true,"text":"Hi there! Send us a message if you want to know more about our service."},"message_form":{"name_optional":false,"text":"Monday to Friday between the hours 8 am and 3 pm please feel free to send us a message.\n\n\nFor plumbing emergencies,\nweekdays after 3pm, holidays or weekends, \nplease call our office at\n905-432-1625.","title":"Message Us","cta_text":"Send"},"mobile":{"call_cta_enabled":true,"title":"Contact Call the Plumbing Doctor Inc.","text":"How would you like to contact us?"},"style":{"primary_color":"#ecc335"},"auto_response":{"enabled":true,"text":"Thanks for messaging The Plumbing Doctor! We are currently away from our desk. Sorry we missed your call. We truly appreciate your business. If this is an emergency or if you need immediate assistance, please contact 905-432-1625 or 1-800-814-7014. Our telephone lines are monitored 24/7. "},"chatbot":{"auto_load":true,"enabled":false,"name":"SparkAI","intro":{"enabled":false,"text":"Have a question? Ask our chatbot, SparkAI"}},"phone_number":{"national_format":"(289) 207-5264","value":"+12892075264"},"call_phone_number":{"national_format":"(905) 432-1625","value":"+19054321625"},"locations":[],"location_selection":{"title":"Location Selection","text":"Select the location which you would like to contact","skip_text":"Skip"},"confirmation":{"title":"Thanks for your message","text":"We will follow up with you shortly by text message."}} }; window.addEventListener( "message", ( event ) => { if( event.origin.indexOf( origin_url ) === -1 || ! event.data?.event_name ) { return; } if( typeof gtag !== "undefined" ) { gtag( "event", event.data.event_name, { name: event.data.event_name } ); } }, false );