{"id":105023,"date":"2025-02-23T10:19:50","date_gmt":"2025-02-23T10:19:50","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/gtmtips-fire-trigger-when-user-is-about-to-leave-the-page\/"},"modified":"2025-02-23T10:19:50","modified_gmt":"2025-02-23T10:19:50","slug":"gtmtips-fire-trigger-when-user-is-about-to-leave-the-page","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=105023","title":{"rendered":"#GTMTips: Fire Trigger When User Is About To Leave The Page"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>One of the great ways to leverage <a href=\"https:\/\/tagmanager.google.com\/\">Google Tag Manager<\/a> in your web analytics tracking is to make use of all the possible <a href=\"https:\/\/www.simoahava.com\/analytics\/simple-custom-event-listeners-gtm\/\">custom events<\/a> that the browser has to offer. One such event is <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/Events\/beforeunload\"><code>beforeunload<\/code><\/a>. It\u2019s dispatched in the browser when the user is about to <em>unload<\/em> the page. This means, typically, that the user is about to leave the page after clicking a link, or they are about to exit the browser by either closing the tab or the entire window.<\/p>\n<p>We can use this event for many things, but in this article I\u2019ll show you how to setup the listener, and then use it to send an event to <a href=\"https:\/\/analytics.google.com\">Google Analytics<\/a> which contains the <strong>deepest<\/strong> <a href=\"https:\/\/www.simoahava.com\/analytics\/scroll-depth-trigger-google-tag-manager\/\">scroll depth threshold<\/a> the user crossed on the page. So if they scrolled all the way to 75% of the document, this event would send that threshold to Google Analytics. Why? Because sometimes we simply want to know the <strong>farthest<\/strong> the user scrolled to any given page, rather than <strong>all<\/strong> the thresholds they crossed on the way there.<\/p>\n<p>                <span class=\"simmer\"><br \/>\n  <span class=\"close\">X<\/span><\/p>\n<p>\n    <span class=\"fa fa-md fa-bell\"\/><br \/>\n    <strong>The Simmer Newsletter<\/strong>\n  <\/p>\n<p>\n    Subscribe to the <a href=\"https:\/\/www.simoahava.com\/newsletter\/\">Simmer newsletter<\/a> to get the latest news and content from Simo Ahava into your email inbox!\n  <\/p>\n<p>  <\/span><\/p>\n<h2 id=\"tip-82-fire-a-trigger-on-the-beforeunload-event\">Tip 82: Fire a trigger on the <code>beforeunload<\/code> event<\/h2>\n<div style=\"aspect-ratio: 960 \/ 540;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2018\/07\/fire-trigger-beforeunload.jpg\" title=\"Beforeunload listener\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"540\" width=\"960\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2018\/07\/fire-trigger-beforeunload.jpg#ZgotmplZ\" alt=\"Beforeunload listener\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>First of all, let\u2019s create the event listener for <code>beforeunload<\/code>, so that the impatient readers can go right ahead and start working on their own solutions around this trigger.<\/p>\n<blockquote>\n<p>One <strong>important<\/strong> thing to note is that if you use a <code>beforeunload<\/code> listener, you invalidate the <strong>Back-Forward Cache<\/strong> of some browsers (e.g. Firefox). On some websites this might break user experience, so be sure to consult with your developers before implementing this, particularly on pages with forms.<\/p>\n<\/blockquote>\n<p>The tag is a simple <strong>Custom HTML tag<\/strong> that fires on the <strong>All Pages<\/strong> trigger. Feel free to use a more restrictive trigger, if you want the listener to be active only on specific pages.<\/p>\n<p>Here are the contents:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-html\" data-lang=\"html\">script&gt;\n  <span style=\"color:#0aa\">window<\/span>.addEventListener(<span style=\"color:#a50\">'beforeunload'<\/span>, <span style=\"color:#00a\">function<\/span>() {\n    <span style=\"color:#0aa\">window<\/span>.dataLayer.push({\n\t  event: <span style=\"color:#a50\">'beforeunload'<\/span>\n\t});\n  });\n<span style=\"color:#1e90ff;font-weight:bold\">script<\/span>&gt;<\/code><\/pre>\n<\/div>\n<p>All this tag does is create the listener. The listener has a callback which pushes the <code>beforeunload<\/code> custom event into <code>dataLayer<\/code>.<\/p>\n<p>Now if you go to Preview mode, by clicking a link away from any page, you should <em>just<\/em> see the <strong>beforeunload<\/strong> text appear in the Preview mode event list before you are whisked away. If you see it, it means the listener works.<\/p>\n<div style=\"aspect-ratio: 1068 \/ 722;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2018\/07\/beforeunload-event-preview.jpg\" title=\"beforeunload in preview mode\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"722\" width=\"1068\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2018\/07\/beforeunload-event-preview.jpg#ZgotmplZ\" alt=\"beforeunload in preview mode\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next thing to do is to create a <strong>Custom Event trigger<\/strong> with the following settings:<\/p>\n<div style=\"aspect-ratio: 1140 \/ 676;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2018\/07\/custom-event-trigger.jpg\" title=\"beforeunload custom event trigger\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"676\" width=\"1140\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2018\/07\/custom-event-trigger.jpg#ZgotmplZ\" alt=\"beforeunload custom event trigger\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>If you add this trigger to a tag, that tag will fire <em>just<\/em> when the user is about to leave the page.<\/p>\n<h3 id=\"set-the-transport-field-in-google-analytics-tags\">Set the <code>transport<\/code> field in Google Analytics tags<\/h3>\n<p>Because the trigger fires on the threshold of unloading the page, there is a very real risk that the page is unloaded <strong>before<\/strong> the asynchronous request initiated by the tag (firing on the trigger) has time to complete. To let your requests complete in time, you can use the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Beacon_API\">Beacon API<\/a> &#8211; another cool browser feature that\u2019s almost essential to web analytics tracking.<\/p>\n<p>Thankfully, if you are using Google Analytics tags, you don\u2019t need to build the beacon utility yourself. The Universal Analytics library, <strong>analytics.js<\/strong>, has a special field called <a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/analyticsjs\/field-reference#transport\"><code>transport<\/code><\/a>, which you can set to the value <code>beacon<\/code> in case you want to leverate the Beacon API with your Google Analytics hits.<\/p>\n<p>To add this field, either use a <a href=\"https:\/\/www.simoahava.com\/analytics\/google-analytics-settings-variable-in-gtm\/\">Google Analytics Settings variable<\/a>, or override the settings of your tag. Scroll down to <strong>Fields to set<\/strong>, and add a new field:<\/p>\n<p><strong>Field name<\/strong>: <code>transport<\/code><br \/><strong>Value<\/strong>: <code>beacon<\/code><\/p>\n<p>With this setting, the tag now utilizes the Beacon API to dispatch the asynchronous request <em>even if<\/em> the browser has unloaded the page. The cool thing about this implementation is that if the browser doesn\u2019t support this API, the tag automatically falls back to either GET or POST, just like it would normally do.<\/p>\n<p>One \u201cside effect\u201d of using the Beacon API is that the request is automatically turned into a POST request. This means that if you\u2019re using the Network tab of your browser\u2019s developer tools, the request parameters won\u2019t be outlined as nicely as they would with a GET request. For this reason, I strongly recommend you use the <a href=\"https:\/\/chrome.google.com\/webstore\/detail\/google-analytics-debugger\/jnkmfdileelhofjcijamephohjechhna?hl=en\">Google Analytics Debugger<\/a> to analyze the requests.<\/p>\n<h3 id=\"send-the-deepest-scroll-depth-threshold\">Send the deepest Scroll Depth threshold<\/h3>\n<p>To send the deepest (or farthest) the user has scrolled on any given page, you need the following components.<\/p>\n<p><strong>A Scroll Depth trigger with the thresholds configured<\/strong><\/p>\n<div style=\"aspect-ratio: 1218 \/ 720;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2018\/07\/scroll-depth-trigger.jpg\" title=\"Scroll depth trigger\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"720\" width=\"1218\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2018\/07\/scroll-depth-trigger.jpg#ZgotmplZ\" alt=\"Scroll depth trigger\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Note that you <strong>do not<\/strong> need to add this trigger to any tag. Its sole purpose is to push the threshold values into <code>dataLayer<\/code>.<\/p>\n<p><strong>A Google Analytics tag which fires on the <code>beforeunload<\/code> trigger<\/strong><\/p>\n<p>The tag needs to fire on the <code>beforeunload<\/code> trigger, and it needs to send the value of the <a href=\"https:\/\/www.simoahava.com\/analytics\/variable-guide-google-tag-manager\/#scrolling\"><strong>{{Scroll Depth Threshold}}<\/strong> Built-in variable<\/a> to Google Analytics. Don\u2019t forget to add the <code>transport<\/code> field there, too!<\/p>\n<div style=\"aspect-ratio: 1840 \/ 1710;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2018\/07\/scroll-depth-tag.jpg\" title=\"Scroll depth tag\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1710\" width=\"1840\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2018\/07\/scroll-depth-tag.jpg#ZgotmplZ\" alt=\"Scroll depth tag\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Again, feel free to add trigger exceptions or to modify the Custom Event trigger to restrict this tag to fire only on relevant pages. It doesn\u2019t make sense to collect scrolling data on pages where that information is not relevant.<\/p>\n<h2 id=\"summary\">Summary<\/h2>\n<p>Once you\u2019ve created the Custom HTML tag for the listener, the Custom Event trigger, the Scroll Depth trigger, and the Google Analytics tag, you\u2019re good to go. When the user is about to leave any page, the <code>beforeunload<\/code> event triggers your Google Analytics tag. This tag grabs the latest value from <strong>{{Scroll Depth Threshold}}<\/strong> and sends it with the event to GA.<\/p>\n<p>So if the user scrolled all the way down to 70% of the page (if you\u2019ve set it up as a vertical threshold in the trigger settings), the value <code>70<\/code> would get sent with the tag.<\/p>\n<p>This way you\u2019ll preserve your hit quota (remember there\u2019s a <a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/analyticsjs\/limits-quotas#universal_properties\">500 hits per session<\/a> limit in Google Analytics), and you\u2019ll avoid sending a lot of noisy information about the intermediate thresholds to Google Analytics.<\/p>\n<p>The scroll depth trick was just a tangent, though. The <code>beforeunload<\/code> listener can be used for a million different things, such as <a href=\"https:\/\/www.simoahava.com\/analytics\/track-form-abandonment-with-google-tag-manager\/\">form abandonment<\/a> and <a href=\"https:\/\/www.simoahava.com\/analytics\/track-content-engagement-part-2\/\">content engagement<\/a> tracking.<\/p>\n<p>Do you have other cool uses for the <code>beforeunload<\/code> listener? Let us know in the comments!<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>One of the great ways to leverage Google Tag Manager in your web analytics tracking is to make use of all the possible custom events that the browser has to offer. One such event is beforeunload. It\u2019s dispatched in the browser when the user is about to unload the page. This means, typically, that the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":105025,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[1074,14492,18247,4347,22089,21854],"dealstore":[],"offerexpiration":[],"class_list":["post-105023","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-fire","tag-gtmtips","tag-leave","tag-page","tag-trigger","tag-user"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>#GTMTips: Fire Trigger When User Is About To Leave The Page - Som2ny Network<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fivemor.com\/?p=105023\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"#GTMTips: Fire Trigger When User Is About To Leave The Page - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"One of the great ways to leverage Google Tag Manager in your web analytics tracking is to make use of all the possible custom events that the browser has to offer. One such event is beforeunload. It\u2019s dispatched in the browser when the user is about to unload the page. This means, typically, that the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=105023\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-23T10:19:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=105023#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=105023\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"#GTMTips: Fire Trigger When User Is About To Leave The Page\",\"datePublished\":\"2025-02-23T10:19:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=105023\"},\"wordCount\":1025,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=105023#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg\",\"keywords\":[\"Fire\",\"GTMTips\",\"leave\",\"Page\",\"Trigger\",\"User\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=105023#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=105023\",\"url\":\"https:\/\/fivemor.com\/?p=105023\",\"name\":\"#GTMTips: Fire Trigger When User Is About To Leave The Page - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=105023#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=105023#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg\",\"datePublished\":\"2025-02-23T10:19:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=105023#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=105023\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=105023#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=105023#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"#GTMTips: Fire Trigger When User Is About To Leave The Page\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fivemor.com\/#website\",\"url\":\"https:\/\/fivemor.com\/\",\"name\":\"Som2ny Network\",\"description\":\"Daily Deals\",\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fivemor.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/fivemor.com\/#organization\",\"name\":\"Som2ny Network\",\"url\":\"https:\/\/fivemor.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"width\":300,\"height\":86,\"caption\":\"Som2ny Network\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/fivemor.com\"],\"url\":\"https:\/\/fivemor.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"#GTMTips: Fire Trigger When User Is About To Leave The Page - Som2ny Network","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fivemor.com\/?p=105023","og_locale":"en_US","og_type":"article","og_title":"#GTMTips: Fire Trigger When User Is About To Leave The Page - Som2ny Network","og_description":"One of the great ways to leverage Google Tag Manager in your web analytics tracking is to make use of all the possible custom events that the browser has to offer. One such event is beforeunload. It\u2019s dispatched in the browser when the user is about to unload the page. This means, typically, that the [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=105023","og_site_name":"Som2ny Network","article_published_time":"2025-02-23T10:19:50+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=105023#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=105023"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"#GTMTips: Fire Trigger When User Is About To Leave The Page","datePublished":"2025-02-23T10:19:50+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=105023"},"wordCount":1025,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=105023#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg","keywords":["Fire","GTMTips","leave","Page","Trigger","User"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=105023#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=105023","url":"https:\/\/fivemor.com\/?p=105023","name":"#GTMTips: Fire Trigger When User Is About To Leave The Page - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=105023#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=105023#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg","datePublished":"2025-02-23T10:19:50+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=105023#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=105023"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=105023#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/fire-trigger-beforeunload.jpg","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=105023#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"#GTMTips: Fire Trigger When User Is About To Leave The Page"}]},{"@type":"WebSite","@id":"https:\/\/fivemor.com\/#website","url":"https:\/\/fivemor.com\/","name":"Som2ny Network","description":"Daily Deals","publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fivemor.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fivemor.com\/#organization","name":"Som2ny Network","url":"https:\/\/fivemor.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","width":300,"height":86,"caption":"Som2ny Network"},"image":{"@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","caption":"admin"},"sameAs":["https:\/\/fivemor.com"],"url":"https:\/\/fivemor.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/105023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=105023"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/105023\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/105025"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=105023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=105023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=105023"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=105023"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=105023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}