In-depth Developer Instructions for Website Tool Installation
OVERVIEW
Web Installation Methods
Wordpress
WIX
Squarespace
Hubspot
Weebly
Shopify
GoDaddy
Google Sites
NextJs/Vercel
Slideout Widget Javascript API
Analytics Javascript iFrame Events
Other Issues/Troubleshooting
GUIDE INTRO
The RoofQuote PRO™ website installation process is the addition of a single script tag to the <head> section of the desired website pages for the Slide-out widget. And the addition of a single script to the <body> section exactly where you want to see the Full Page embedded widget or Contractor Loan Pro popup button on any of your website pages.
For many customers, the Slide-out widget is a global configuration that appears on all pages.
Note that the snippets in this document will not work. They are only examples. The final script URL is specific to your company and will be available in your Pro Portal dashboard.
WEB INSTALLATION METHOD
Slide-out Javascript Tag
Place the following Javascript snippet in the <head> element of the desired pages.
<script
async
src="https://app.roofle.com/roof-quote-pro-widget.js?id=XXX-YOUR-TOOL-ID-HERE"
></script>
See the Slide-out Widget Javascript API section for advanced controls to program the opening/closing of the Slide-out Widget.
Full Page Embed Tag
- Place the following Javascript snippet in the <body> element of the desired pages.
<script src="https://app.roofle.com/roof-quote-pro-embedded-widget.js?id=XXX-YOUR-TOOL-ID-HERE" async></script>
WORDPRESS (most common)
Roofle has tested version 6.01 of Wordpress
WARNING: changing your Wordpress theme may cause your RoofQuotePRO™ installation to be overwritten.
Wordpress
Additional documentation is coming soon...
Manual installation method:
- Navigate to: Tools -> Theme File Editor -> functions.php
- Add the following code snippet to the bottom of the functions.php file:
// Begin: Include Roof Quote PRO™ script in global <head> element
function include_roof_quote_pro(){
?>
<script
async
src="https://app.roofle.com/roof-quote-pro-widget.js?id=XXX-YOUR-TOOL-ID-HERE"
onLoad="console.log('Loaded Roof Quote PRO™')"
></script>
<?php
};
add_action('wp_head', 'include_roof_quote_pro');
// End: Include Roof Quote PRO™
Plugin Global Installation Method
- Install the Header and Footer plugin: https://wordpress.org/plugins/header-footer/
- Navigate to: Settings -> Header and Footer and select the Header and Footer tab if it is not selected.
- Add the following code snippet to the <head> page section:
<!-- Begin: Include Roof Quote PRO™ script in global <head> element -->
<script
async
src="https://app.roofle.com/roof-quote-pro-widget.js?id=XXX-YOUR-TOOL-ID-HERE"
onLoad="console.log('Loaded Roof Quote PRO™')"
></script>
<!-- End: Include Roof Quote PRO™ -->
Manual Installation of Slideout Widget on Individual Pages
- Navigate to: Tools -> Theme File Editor -> functions.php
- Add the following code snippet to the bottom of the functions.php file:
// Begin: Include Roof Quote PRO™ script on specific page <head> elements
function include_roof_quote_pro_on_specific_pages(){
if( is_page( array( 'sample-page', 'second-page' ) ) ){
?>
<script
async
src="https://app.roofle.com/roof-quote-pro-widget.js?id=XXX-YOUR-TOOL-ID-HERE"
onLoad="console.log('Loaded Roof Quote PRO™')"
></script>
<?php
}
};
add_action('wp_head', 'include_roof_quote_pro_on_specific_pages');
// End: Include Roof Quote PRO™
Online Examples
https://kinsta.com/knowledgebase/add-code-wordpress-header-footer/
Manual Installation of Full Page Widget
Brad to provide a more complete guide here.
WP Rocket Plugin
There is a known issue that WP Rocket rewrites the embed code, causing it to not be able to load correctly.
A suggested fix is to add roof-quote-pro-widget.js and roof-quote-pro-embedded-widget.js to the list of Excluded Files in the Javascript Minification section of WP Rocket.
WP Rocket -> Settings -> File Optimization -> Javascript Files section
Nitro Pack Plugin
There is a known issue that Nitro Pack rewrites the embed code, causing it to not be able to load correctly.
A suggested fix is to add roof-quote-pro-widget.js and roof-quote-pro-embedded-widget.js to the list of Excluded Resources section of Nitro Pack.
https://support.nitropack.io/hc/en-us/articles/1500002527542-Excluded-Resources
Elementor Wordpress Site Generator
Elementor Wordpress Site Generator documentation:
https://developers.elementor.com/docs/scripts-styles/frontend-scripts/
Roofle has not tested SiteGround yet for further documentation.
SiteGround Plugin
There is a known issue that SiteGround rewrites the embed code, causing it to not be able to load correctly.
A suggested fix is to review the following documentation and add roof-quote-pro-widget.js and roof-quote-pro-embedded-widget.js to the exclude lists you prefer.
https://wordpress.org/plugins/sg-cachepress/
Roofle has not tested SiteGround yet for further documentation.
Beta fix: If you go to the theme editor in the WP back end and select the functions .php file like below, if you plug in the following code at the bottom of the .php file and save it, the optimizer will ignore the widget and it should work normally at that point
add_filter( 'sgo_javascript_combine_excluded_external_paths', 'js_combine_exclude_external_script' );
function js_combine_exclude_external_script( $exclude_list ) {
$exclude_list[] = 'app.roofle.com';
$exclude_list[] = 'https://app.roofle.com/roof-quote-pro-embedded-widget.js';
$exclude_list[] = 'https://app.roofle.com/roof-quote-pro-widget.js';
return $exclude_list;
}
WIX
Slide-out Installation Method
- Turn on Dev Mode
- Go to Site -> My Dashboard
- Go to Settings -> Custom Code -> + Add Custom Code
- Paste the code snippet in and give the code a name
- Add the code to all or desired pages
- Choose “Place Code in: Head”
Online Example
Full Page Installation Method
- Turn on Dev Mode
- Select Add Section
- Select Blank Section
- Select and highlight the new Section
- Select Quick Edit -> Add Elements -> Embed Code -> Embed HTML
- Paste in the div tag AND the script tag
- E.g.
<script src="https://app.roofle.com/roof-quote-pro-embedded-widget.js?id=XXX-YOUR-TOOL-ID-HERE" async></script>
- E.g.
<div id="roof-quote-pro-embedded"></div>
- Click Update
- Use the drag handles to drag the embedded section to be the full width and height of the Section you created. Or, use the Stretch to Full Width <-> feature in the Wix interface
- Wix websites use fixed-height sections. We recommend a height of 1040 pixels or taller.
Individual Page Installation Workaround
When installing the widget on individual pages Wix will persist the widget on page changes due to their page loading strategy. The result is the widget may appear on pages you did not want to include.
A workaround to this issue is to add the following Custom Code block to the Body - End section of all pages.
<script type="text/javascript">
(function (history) {
const pushState = history.pushState;
history.pushState = function (state) {
pushState.apply(history, arguments);
setTimeout(toggleWidgetFromPushState, 250);
};
function toggleWidgetFromPushState() {
const script = document.querySelector(
'script[src^="https://app.roofle.com/roof-quote-pro-widget.js"]'
);
const widget = document.getElementById("roof-quote-pro-widget");
if (widget) {
widget.style.display = !!script ? "" : "none";
}
}
})(window.history);
</script>
SQUARESPACE
Slide-out Global Installation Method
- Go to Settings -> Advanced -> Code Injection
- Paste the code snippet in the Header section and Save
Slide-out Individual Page Method
- Go to the desired page
- Go to Settings (gear) icon -> Advanced
- Paste the code snippet in the Header section and Save
Full Page Installation Method
- Go to the desired page
- Click Add Section -> Blank Section
- Select Add Block -> Code
- Expand the block size to the complete width of the grid (see screenshot)
- Click the Edit Pencil Icon
- Paste in the Snippet (be sure there are no “curly quotes”, they must be straight HTML quotes).
<script src="https://app.roofle.com/roof-quote-pro-embedded-widget.js?id=XXX-YOUR-TOOL-ID-HERE" async></script>
<div id="roof-quote-pro-embedded"></div> - Click Save
HUBSPOT
Hubspot provides multiple locations to include the HTML Javascript Tag in the <head> section of the template or individual page.
Installation For Templates
For templates, you can include the tag in the “Additional <head> markup” section of the template editor.
Marketing -> Files and Templates -> Design Tools -> My Template
Use a custom HTML module to insert the script for the full-page embedded widget.
Installation For Pages
For pages, you can include the tag by navigating to:
Marketing -> Website -> Website Pages -> My Page -> Edit -> Settings -> Advanced Settings -> Head HTML
WEEBLY
https://weeblytutorials.com/embed-javascript-weebly/
SHOPIFY
https://speedboostr.com/how-to-safely-edit-your-shopify-theme/
GODADDY WEBSITE BUILDER
Add websites.godaddy.com to the domain list for testing the widget in GoDaddy’s website editor.
Slide-out Installation Method
Due to technical restrictions enforced by GoDaddy, it is not possible to install the slide-out widget on websites built with GoDaddy Website Builder. You must use the full-page installation method.
Full Page Installation Method
To enable previewing the widget in the website builder, we recommend adding websites.godaddy.com to the domain whitelist in addition to the contractor domain.
The Full Page embed tags can be installed with the following steps:
- Click Edit My Site to enter the website editor.
- Locate the desired area of the page you would like to install the widget, and click Add Section.
- Type “HTML” into the search box and select the Add Content button for HTML.
- Paste the Full Page embed code into the Custom Code text box and save.
<script src="https://app.roofle.com/roof-quote-pro-embedded-widget.js?id=XXX-YOUR-TOOL-ID-HERE" async></script>
<div id="roof-quote-pro-embedded"></div> - Click Preview My Site to ensure it saves.
GoDaddy E-Store
https://findhelp.wsb-estoregodaddy.com/hc/en-us/articles/360059681631-Header-HTML
GOOGLE SITES
Slide-out Installation Method
Due to technical restrictions enforced by Google, it is not possible to install the slide-out widget on websites built with Google Sites. You must use the full-page installation method.
Full Page Installation Method
- Go to the desired page.
- Click the section of the page you wish the widget to be placed after.
- In the Insert tab of the editor, select Embed.
- Select the Embed Code tab.
- Paste the Full Page embed code into the Custom Code text box and save.
<script src="https://app.roofle.com/roof-quote-pro-embedded-widget.js?id=XXX-YOUR-TOOL-ID-HERE" async></script>
<div id="roof-quote-pro-embedded"></div> - Select Next -> Insert
- Use the box editor to make the widget full width by dragging the handles to the edges of the page.
- Use the box editor to increase the height of the widget a good amount. You will need to test the published page to see if there is enough height for the widget to work well.
NEXT.JS
The Next.Js code snippet can be placed globally in _app.js, or on individual pages.
import Script from "next/script";
<Script
strategy="beforeInteractive"
src="https://app.roofle.com/roof-quote-pro-widget.js?id=XXX-YOUR-TOOL-ID-HERE"
/>
For the full page embed script, use `afterInteractive` along with the <div> element.
<Script
strategy="afterInteractive"
src="https://app.roofle.com/roof-quote-pro-embedded-widget.js?id=XXX-YOUR-TOOL-ID-HERE"
async
/>
<div id="roof-quote-pro-embedded" />
SLIDE-OUT WIDGET JAVASCRIPT API
There is a Javascript API to control the widget. The widget is exposed onto the `window` object as `RoofQuotePro`.
The following methods are available:
- RoofQuotePro.open()
- RoofQuotePro.close()
- RoofQuotePro.toggle()
ANALYTICS JAVASCRIPT iFRAME EVENTS
The widget iFrame is configured to emit events for analytics purposes. These events can be captured with Javascript in the parent window and utilized for the analytics solution of your choice (e.g. Google Analytics).
The following code is a recommended configuration and is an example of sending the Analytics Events directly to Google Analytics. This code can be installed directly on pages which have Roof Quote PRO installed, or it can be added to Google Tag Manager as a Custom HTML Tag with the DOM ready trigger.
Read How to set up Google Tag Manager to record RQP events and conversions in Google Analytics. This is helpful for optimizing your Google Ads campaigns.
<script>
window.addEventListener("message", function (event) {
if (event.origin.includes("app.roofle.com")) {
if (!dataLayer) {
console.warn("Google Analytics is not installed.");
return;
}
// Track the widget was loaded
if (event.data.event === "Roof-quote-pro-viewed") {
send("roofquotepro_viewed");
}
// Track the address entered event
if (event.data.event === "Address-loaded") {
send("roofquotepro_address_loaded");
}
// Track the contact form submitted event
if (event.data.event === "Contact-form-submitted") {
send("roofquotepro_lead_submitted");
}
// Track the help/other contact form submitted event
if (event.data.event === "Get-help-form-submitted") {
send("roofquotepro_other_contact_submitted");
}
// Track the product detail requested event
if (event.data.event === "Product-requested-cta") {
send("roofquotepro_product_requested");
}
}
function send(event) {
console.log("Roof Quote PRO™ sent the " + event + " event to Google Analytics");
dataLayer.push({
event: event,
});
}
});
</script>
Event Names
The following is a list of event names that the iframe may emit. These names will not change, but more events may be added in the future.
roofquotepro_address_loaded
roofquotepro_slope_changed
roofquotepro_roof_renamed
roofquotepro_roof_inclusion_toggled
roofquotepro_edit_roofs
roofquotepro_lead_form_displayed
roofquotepro_lead_submitted
roofquotepro_other_contact_form_displayed
roofquotepro_other_contact_submitted
roofquotepro_product_requested
Event Example Data
The following is example JSON emitted by a single event, all events contain the data property which holds the event information:
data: {
"event": "Contact-form-submitted",
"sessionId": "EvQPb3PWVlUWuJaXSNBc6",
"marketSlug": "minneapolis-st-paul_mn"
}
OTHER ISSUES /TROUBLESHOOTING
Custom Website CSP Errors
Some sites have Content Security Policy (CSP) restrictions. The web developer will need to update the website headers to allow the iframe to be hosted on their domain.