This file contains hidden or 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
// REPLACE THIS WITH THE CAMPAIGN'S ID | |
var campaignId = 'XXXXXX'; | |
document.addEventListener('tp.Main.EventListener.Ready', function () { | |
var event = new CustomEvent('tp.Custom.Submit', { | |
bubbles: true, | |
cancelable: true, | |
detail: { | |
widgetId: campaignId, |
This file contains hidden or 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> | |
// Your custom JavaScript. | |
// If you're adding jQuery, please make sure your website already has a jQuery library loaded, or you will need to add it yourself. | |
</script> |
This file contains hidden or 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 wp_footer(); ?> | |
// Your JavaScript goes below | |
<script type="text/javascript"> | |
// This example calls om.Campaign.init runs once the campaign is initialized | |
document.addEventListener('om.Campaign.init', function(event) { | |
// This event is passed the Campaign object | |
console.log(event.detail.Campaign); |
This file contains hidden or 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> | |
var om_load_jquery = false; | |
</script> |
This file contains hidden or 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
<a id="iframeCover" class="om-trigger-conversion"></a> | |
<div id="formInstructions">Double Click Below to Get Started</div> | |
<iframe src="https://docs.google.com/forms/d/e/1FAIpQLScS9FplM0-5VouPWZareiRJjtIZLO_g5jcDW1eQ52k2W_2SyQ/viewform?embedded=true" width="500" height="520" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe> | |
<script type="text/javascript"> | |
var myIframeCover = document.querySelector('html div#om-{{id}} #iframeCover'); | |
myIframeCover.addEventListener("click", function() { | |
myIframeCover.style.display = 'none'; | |
}); | |
</script> |
This file contains hidden or 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 type="text/javascript"> | |
var myIframeCover = document.querySelector('html div#om-{{id}} #iframeCover'); | |
myIframeCover.addEventListener("click", function() { | |
myIframeCover.style.display = 'none'; | |
}); | |
</script> |
This file contains hidden or 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 type="text/javascript"> | |
var form = document.querySelector('html div#om-YOUR-OPTIN-SLUG .NAMESPACE-FieldsElement--content'); | |
var errorAlert = document.querySelector("html div#om-YOUR-OPTIN-SLUG .NAMESPACE-FieldsElement--content #errorAlert"); | |
var formSubmitButton = document.querySelector("html div#om-YOUR-OPTIN-SLUG .NAMESPACE-FieldsElement--content input.om-trigger-conversion"); /* This variable is a flag to know if a user has attempted to submit at least once. */ | |
var attemptToSubmitAtLeastOnceFlag = false; /* This code hides the error field. */ | |
function fieldsCheck() { | |
var lookForInvalidInputs = document.querySelectorAll('html div#om-YOUR-OPTIN-SLUG .NAMESPACE-FieldsElement--content :invalid'); /* Scan Form for All Inputs that currently have a :placeholder-shown pseudo-class */ | |
var lookForInputsShowingPlaceholders = document.querySelectorAll('html div#om-YOUR-OPTIN-SLUG .NAMESPACE-FieldsElement--content :placeholder-shown'); /* If there are no "invalid" states OR P |
This file contains hidden or 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
document.addEventListener('om.Html.append.after', function(event) { | |
console.log('The ' + event.detail.Campaign.id + '-' + event.detail.Campaign.type + ' main container is now attached to the outer DOM.'); | |
} ); |
This file contains hidden or 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
// Function SaveToDisk forces file download instead of viewing in browser | |
function SaveToDisk(fileURL, fileName) { | |
// for non-IE | |
if (!window.ActiveXObject) { | |
var save = document.createElement('a'); | |
save.href = fileURL; | |
save.target = '_blank'; | |
save.download = fileName || 'unknown'; | |
var event = document.createEvent('Event'); |
This file contains hidden or 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
document.addEventListener('om.Action.redirect', function(event) { | |
console.log(“Redirect in progress...”); | |
} ); |
NewerOlder