om-custom-smart-tag-all-query-args.js

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…Continue reading

om.Dtr.init.js

document.addEventListener(‘om.Dtr.init’, function(event) { console.log(event.detail.Dtr); console.log(event.detail.Campaign); // Registers a custom `name` smart tag. event.detail.Dtr.setCustomVariable(‘name’, ‘Thomas’); } );Continue reading

om-js-events-ga-add-param.js

document.addEventListener( ‘om.GoogleAnalytics.preConversionEvent’, function( event ) { const { gaEvent } = event.detail; gaEvent.params.your_param1 = param1value; gaEvent.params.your_param2 = param2value; } );Continue reading

om-js-event-ga-name-change.js

document.addEventListener( ‘om.GoogleAnalytics.preConversionEvent’, function( event ) { const { gaEvent } = event.detail; gaEvent.name = ‘generate_lead’; // generate lead is a recommended event } );Continue reading

om-js-events-ga-impression.js

// OptinMonster Javascript Event for Google Analytics Impression Event document.addEventListener( ‘om.GoogleAnalytics.preImpressionEvent’, function( event ) { var ga = event.detail.GoogleAnalytics; var campaign = event.detail.Campaign; var gaEvent = event.detail.gaEvent; if ( ‘YOUR_CAMPAIGN_ID’ !== campaign.id ) { return; } // custom code goes…Continue reading

om-js-events-ga-conversion.js

// OptinMonster Javascript Event for Google Analytics Conversion Event document.addEventListener( ‘om.GoogleAnalytics.preConversionEvent’, function( event ) { var ga = event.detail.GoogleAnalytics; var campaign = event.detail.Campaign; var gaEvent = event.detail.gaEvent; if ( ‘YOUR_CAMPAIGN_ID’ !== campaign.id ) { return; } // custom code goes…Continue reading

om-manually-set-global-cookies.js

// Set OptinMonster Global Cookies when this function runs function setGlobalCookies() { document.cookie = “omSuccessCookie=true; expires=Fri, 31 Dec 9999 23:59:59 GMT”; document.cookie = “omGlobalSuccessCookie=true; expires=Fri, 31 Dec 9999 23:59:59 GMT”; document.cookie = “omGlobalInteractionCookie=true; expires=Fri, 31 Dec 9999 23:59:59 GMT”; }Continue reading

om-emberjs.js

// Using Ember.js. import Route from ‘@ember/routing/route’; export default Route.extend({ beforeModel(transition) { if (window.om5678_1234) { window.om5678_1234.reset(); } } });Continue reading

om-nextjs14-layout.tsx

import ‘@/app/ui/global.css’; import {RouteChangeListener} from ‘@/app/route-change-listener.tsx’; export default function RootLayout({ children, }: { children: React.ReactNode; }) { return ( {children} ); }Continue reading