To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
). Must load after Popups for Divi.
*
* Setup:
* - Popup section: Popup tab > "This is a Popup" ON, Popup ID = newsletter-popup
* - Popup form: duplicate of footer Gravity Form, AJAX enabled
* (ajax="true" in shortcode / module), confirmation type = Text (not redirect)
* - Popup form Mailchimp feed: same audience, tag "Newsletter Pop Up"
* - Set POPUP_FORM_ID / FOOTER_FORM_ID below
*
* Rules:
* - Shows on page load (after DELAY_MS), max once per browser session
* - Once closed: hidden for 30 days
* - Never shown to anyone who has signed up via either form on this browser,
* or who arrives from a Mailchimp campaign link (mc_cid / utm_medium=email)
*
* GTM:
* - Data Layer Variable: form_location
* - Trigger: Custom Event = newsletter_signup
* - GA4 Event tag: event name newsletter_signup, param form_location = {{DLV - form_location}}
* (consent settings: require analytics_storage)
* - GA4: custom dimension (event scope) form_location; mark newsletter_signup as key event
*/
(function () {
var POPUP_ID = 'newsletter-popup';
var POPUP_FORM_ID = 2;
var FOOTER_FORM_ID = 1;
var DISMISS_DAYS = 30;
var DELAY_MS = 3000; // e.g. 3000 to let the cookie banner settle first
var KEY_DISMISSED = 'js_nl_dismissed';
var KEY_SUBSCRIBED = 'js_nl_subscribed';
var COOKIE_SHOWN = 'js_nl_shown';
function lsGet(k) { try { return localStorage.getItem(k); } catch (e) { return null; } }
function lsSet(k, v) { try { localStorage.setItem(k, v); } catch (e) {} }
// Session cookie (no expiry) so "once per session" holds across tabs
function shownThisSession() { return document.cookie.indexOf(COOKIE_SHOWN + '=1') !== -1; }
function markShown() { document.cookie = COOKIE_SHOWN + '=1; path=/; SameSite=Lax'; }
function fromNewsletter() {
var q = new URLSearchParams(window.location.search);
return q.has('mc_cid') || (q.get('utm_medium') || '').toLowerCase() === 'email';
}
function isSuppressed() {
if (fromNewsletter()) lsSet(KEY_SUBSCRIBED, '1');
if (lsGet(KEY_SUBSCRIBED)) return true;
if (shownThisSession()) return true;
var dismissed = parseInt(lsGet(KEY_DISMISSED), 10);
return !!dismissed && (Date.now() - dismissed) < DISMISS_DAYS * 864e5;
}
// Display rules
if (window.DiviArea) {
DiviArea.addAction('ready', function () {
if (isSuppressed()) return;
window.setTimeout(function () {
markShown();
DiviArea.show(POPUP_ID);
}, DELAY_MS);
});
DiviArea.addAction('hide_area', function (area) {
if (area.hasId(POPUP_ID)) lsSet(KEY_DISMISSED, String(Date.now()));
});
}
// Sign-up tracking (fires only after a successful AJAX submission)
if (window.jQuery) {
jQuery(document).on('gform_confirmation_loaded', function (event, formId) {
formId = parseInt(formId, 10);
var location = formId === POPUP_FORM_ID ? 'popup'
: formId === FOOTER_FORM_ID ? 'footer'
: null;
if (!location) return;
lsSet(KEY_SUBSCRIBED, '1');
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'newsletter_signup', form_location: location });
});
}
})();