// 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
// 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
// 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
‘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
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
// 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