This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* HubSpot Embedded Form Accessibility Pollyfills | |
* | |
* This script fixes the HubSpot HTML blunders that make their embedded forms inaccessible for assistive technology. | |
* - Replaces/removes improper use of <fieldset>, <legend>, <label>, and role attributes. | |
* - Note - this can cause forms configured for mulitple column field layouts to break - you will need to adjust your CSS accordingly. | |
**/ | |
hubspotFormA11y = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* You'll want to add this to GTM using an "All Pages" trigger - | |
* Note - make sure you set it to only fire "once per-page" to prevent issues with re-registering the listener on SPAs | |
**/ | |
window.addEventListener('message', function(message){ | |
if (message.origin != 'https://play.hubspotvideo.com') return; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if ( window.parent.postMessage ) { | |
window.parent.postMessage({ | |
'event': 'Form Submission', // Never change this | |
'form_id': '1234', // The Pardot form ID (you can get this from the form edit page URL) | |
'form_label': '[Whitepaper] - The 2020 State of Digital Accessibility', // This can really be whatever you want.. but make sure its descriptive | |
'form_action': 'Gated Resource Download' // See suggested Form Actions | |
}, '*'); | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function() { | |
var dataArrayToObject = function(data) { | |
var fields = {}; | |
for ( var i = 0; i < data.length; i++ ) { | |
fields[data[i].name] = data[i].value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hbspt.forms.create({ | |
portalId: "XXXXXX", | |
formId: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", | |
inlineMessage: 'Please wait...', | |
onFormSubmit: function($form){ | |
// We'll store our "object" to transform into a query string here. | |
// If you want to hard-code a value that isn't part of the form - add it in here. | |
var queryObj = { | |
q3: 'myself' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* !!!!!! | |
ALWAYS CREATE A BACKUP BEFORE RUNNING THESE COMMANDS! | |
!!!!!! */ | |
UPDATE wp_options | |
SET option_value = replace(option_value, 'https://old-domain.com', 'https://new-domain.com') | |
WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts | |
SET guid = replace(guid, 'https://old-domain.com', 'https://new-domain.com'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Finds all Pardot form iframes and appends a ?embedded_on= query parameter to the source. | |
* Very useful for fixing the crappy issues with pardot tracking... | |
*/ | |
add_filter( 'the_content', 'pardot_iframe_src_filter', 99, 1 ); | |
function pardot_iframe_src_filter( $content ) { | |
global $post; |