Skip to content

Instantly share code, notes, and snippets.

View ericakfranz's full-sized avatar

Erica Franz ericakfranz

View GitHub Profile
html div#om-{{id}} {
margin-right: -20px !important;
height: 540px !important;
top: calc(540px / 2) !important;
bottom: calc(540px / 2) !important;
margin-top: auto !important;
margin-bottom: auto !important;
animation: 1s ease-out 0s 1 slideInFromRight;
}
@keyframes slideInFromRight {
@ericakfranz
ericakfranz / setUTMCookie.js
Created February 23, 2022 20:45
Set a cookie if the URL contains specific UTM parameters.
function setUTMCookie() {
// Search the URL
var url = window.location.search;
// Store the UTMs we're searching for in a variable
var emailCampaignUTMs = '?utm_source=digg&utm_medium=email&utm_campaign=free_plus_shipping&utm_content=hhc_bundle';
// Calculate the expiration date for our cookie (1 year from the date it's set)
var cookieDate = new Date;
html div#om-{{id}} {
right: auto !important;
margin-left: 20px !important;
}
html div#om-{{id}} {
width: 350px !important;
left: calc(350px / 2) !important;
right: calc(350px / 2) !important;
margin-left: auto !important;
margin-right: auto !important;
}
html div#om-{{id}} {
top: 0px !important;
bottom: unset !important;
width: 350px !important;
left: calc(350px / 2) !important;
right: calc(350px / 2) !important;
margin-left: auto !important;
margin-right: auto !important;
transition: top 0.3s ease 0s !important;
}
html div#om-{{id}} {
top: 0px !important;
bottom: unset !important;
right: auto !important;
margin-left: 20px !important;
transition: top 0.3s ease 0s !important;
}
html div#om-{{id}} {
top: 0px !important;
bottom: unset !important;
transition: top 0.3s ease 0s !important;
}
@ericakfranz
ericakfranz / om-change-monsterlink-url.js
Last active January 31, 2022 20:03
Specific use-case for a customer to remove the MonsterLink menu item from the site once the campaign has been seen. This will hide the campaign both on the first instance of seeing and closing the campaign, then on subsequent visits when we check if the cookie exists from previously seeing the campaign.
@ericakfranz
ericakfranz / om-custom-smart-tag-specific-query-args.js
Last active June 27, 2023 20:06
OptinMonster Custom Smart Tag to capture a specific query arg.
const queryString = window.location.search; // capture all query args
const urlParams = new URLSearchParams(queryString); // parse parameters
const paramName = 'utm_medium'; // create variable to re-use
const medium = urlParams.get(paramName); // call our specific parameter
document.addEventListener('om.Dtr.init', function(event) {
// Registers {{query_arg}} smart tag that outputs a specific query arg from the current page.
event.detail.Dtr.setCustomVariable('query_arg', '?' + paramName + '=' + medium);
});
@ericakfranz
ericakfranz / om-custom-smart-tag-all-query-args.js
Last active June 27, 2023 20:06
OptinMonster Custom Smart Tag to capture all query args.
const queryString = window.location.search; // capture all query args
document.addEventListener('om.Dtr.init', function(event) {
// use this event instead if added directly through the OM campaign builder
// document.addEventListener('om.Campaign.load', function(event) {
// Registers {{query_args}} smart tag that outputs all query args from the current page.
event.detail.Dtr.setCustomVariable('query_args', queryString);
});