Skip to content

Instantly share code, notes, and snippets.

View ericakfranz's full-sized avatar

Erica Franz ericakfranz

View GitHub Profile
@ericakfranz
ericakfranz / om-translate-copied.js
Created January 26, 2024 20:45
OptinMonster Click to Copy button "Copied!" text translation script
document.addEventListener('om.Main.init', function (evt) {
var Strings = evt.detail._utils.strings;
// Replace ¡Copiada! below with the text you wish to use.
Strings['Copied!'] = '¡Copiada!';
});
@ericakfranz
ericakfranz / om-monsterlink.html
Created January 26, 2024 20:39
Text MonsterLink example
@ericakfranz
ericakfranz / om-button-monsterlink.html
Created January 26, 2024 20:38
Button MonsterLink example.
@ericakfranz
ericakfranz / om-image-monsterlink.html
Created January 26, 2024 20:37
Image MonsterLink example
@ericakfranz
ericakfranz / om-monsterlink-mobile-variant.html
Created January 26, 2024 20:35
MonsterLink with mobile variation
@ericakfranz
ericakfranz / special-monsterlink.html
Created January 26, 2024 20:31
MonsterLink from a non `a` tag element
@ericakfranz
ericakfranz / limit-om-campaigns.js
Created February 6, 2023 23:37
Limit OM Campaigns
/**
* Limit OptinMonster Campaigns
* @author Erica Franz
* @url https://fatpony.me
* @desc Show only one OptinMonster campaign per page visit regardless of campaign type.
*/
// Run this script when the first Campaign is shown
document.addEventListener('om.Campaign.afterShow', function(event) {
// Locate and remove only empty HTML placeholders for campaigns
@ericakfranz
ericakfranz / WPForms-OMConversion.js
Last active August 2, 2022 16:25
Trigger a conversion in OptinMonster when a specific WPForms AJAX form is submitted.
// Let's trigger an OptinMonster conversion only after sucessfull WPForms submission (requires AJAX in WPForms enabled). Piece-mealed from https://wpforms.com/developers/how-to-open-a-new-link-on-form-submission/
// We can use jQuery here because it's a WPForms dependency
jQuery( function( $ ) {
// Edit to change 521 to the ID of your specific WPForms form.
$( '#wpforms-form-521' ).on( 'wpformsAjaxSubmitSuccess', function( e ) {
// trigger conversion
om{{id}}.Listeners.convert();
@ericakfranz
ericakfranz / om-privacy-checkbox-field.css
Last active November 3, 2023 23:07
Style the privacy checkbox field.
html div#om-{{id}} .{{ns}}-FieldsElement--wrapper input[type=checkbox][name="FieldsElement--privacyText-checkbox"] {
vertical-align: top !important;
}
@ericakfranz
ericakfranz / custom-smart-tag-redirect-to-referrer.js
Last active April 25, 2022 20:26
Creates a {{referrer}} custom smart tag in OptinMonster to output the referrer URL, or if it is empty redirect to another specific URL. Typically used in the "redirect to a URL" success action for an optin form or button element.
function myReferrer() {
var ref = document.referrer;
if(!ref) {
// redirect to a specific URL if referrer doesn't exist
var redirect = 'https://optinmonster.com';
} else var redirect = ref;
// Let's print what referrer is being passed into the dev tools console, remove this in production
console.log(ref);