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

om-nextjs14.js

‘use client’; import { usePathname } from ‘next/navigation’; import { useEffect, useState } from ‘react’; export function RouteChangeListener() { const pathname = usePathname(); const [changes, setChanges] = useState(0); useEffect(() => { if (window.om5678_1234) { window.om5678_1234.reset(); } setChanges((prev) => prev +…Continue reading

om-nextjs.js

import { useEffect } from ‘react’; import { useRouter } from ‘next/router’; const OptinMonsterEmbed = () => { const router = useRouter() useEffect(() => { const handleRouteChange = (url, { shallow }) => { if (window.om5678_1234) { window.om5678_1234.reset(); } }…Continue reading

om-angularjs.js

// Using AngularJS. var myApp = angular.module(‘myApp’, []); myApp.run(function($rootScope) { $rootScope.$on(“$locationChangeStart”, function(event, next, current) { if (window.om5678_1234) { window.om5678_1234.reset(); } }); });Continue reading