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
document.addEventListener('om.Optin.success', function(event) { | |
event.detail.Campaign.startClose(); | |
} ); |
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
document.addEventListener('om.Optin.error', function(event) { | |
const url = "http://optinmonster.com"; | |
window.location.href = url; | |
} ); |
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
document.addEventListener('om.Optin.init.submit', function(event) { | |
// This event is passed the Campaign object | |
console.log(event.detail.Campaign); | |
// This event is passed the Optin object | |
console.log(event.detail.Optin); | |
} ); |
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
document.addEventListener('om.Optin.init.submit', function(event) { | |
// Grab the email address submitted by the user. | |
const email = event.detail.Optin.data.fields.email; | |
// Test to ensure it is a proper email. Otherwise, redirect to another page. | |
if ( /@yahoo.com$/.test(email) || /@gmail.com$/.test(email) || /@hotmail.com$/.test(email) || /@googlemail.com$/.test(email) || /@live.com$/.test(email) || /@aol.com$/.test(email) || /@outlook.com$/.test(email) || /@comcast.net$/.test(email) || /@inbox.com$/.test(email) || /@hushmail.com$/.test(email) || /@lycos.com$/.test(email) || /@zoho.com$/.test(email) || /@gmx.com$/.test(email) ) { | |
event.detail.Optin.success = function(){ | |
return window.location.href = 'http://optinmonster.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
document.addEventListener('om.Analytics.conversion', function(event) { | |
dataLayer.push({ | |
'event': 'gaTriggerEvent', | |
'gaEventCategory': 'form', | |
'gaEventAction': 'submit', | |
'gaEventLabel': 'optin-monster' | |
}); | |
} ); |
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
document.addEventListener('om.Analytics.impression', function(event) { | |
console.log(event.detail.Campaign.id + '-' + event.detail.Campaign.type + ' successfully tracked an impression.'); | |
} ); |
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
document.addEventListener('om.Styles.positionPopup', function(event) { | |
const campaign_selector = "#om-" + event.detail.Campaign.id + "-" + event.detail.Campaign.view; | |
$(campaign_selector).dragon(); | |
} ); |
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
document.addEventListener('om.Campaign.afterClose', function(event) { | |
if (event.detail.Campaign.id === "CAMPAIGN_ID") { | |
// Add your own logic to play video on page | |
} | |
} ); |
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
document.addEventListener('om.Campaign.close', function(event) { | |
const url = "http://optinmonster.com"; | |
window.location.href = url; | |
} ); |
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
document.addEventListener('om.Campaign.show', function(event) { | |
if (event.detail.Campaign.id === "CAMPAIGN_ID") { | |
// Add your own logic to pause video on page | |
} | |
} ); |