This page
...
explains how to implement the preezie widget into your
...
webpages using Google Tag Manager.
...
Initial Setup:
*ensure that your container code is pasted in your page(s) before starting
Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Initial Setup for embedded journeys (single-code snippet version)
Create a new GTM tag with your desired name, we recommend ‘preezie-widgets-{pagename}’
The type of tag must be set to custom HTML, then paste in the <script> tag found in your journey/connector settings under Code Snippet
There are 2 versions, choose the version including data-targets and data-isafter values, this will allow you to position where the widget loads on the page easily:
For example
Code Block | ||||
---|---|---|---|---|
| ||||
<script type="text/javascript" src="https://widget-cdn.preezie.com/production/preguide.min.js" data-widgetid="123456789" data-targets="header-container" data-isafter="true"></script> |
Now update header-container to the HTML class or ID on your page where you want preezie to appear after: data-targets="header-container"
So if your HTML
...
uses class="section-header"
instead it would become data-targets="section-header"
Then underneath that, add this snippet below it:
Code Block | ||
---|---|---|
| ||
<script>
window.document.dispatchEvent(new Event("DOMContentLoaded", {
bubbles: true,
cancelable: true
}));
</script> |
The final tag would look like this:
Code Block | ||||
---|---|---|---|---|
| ||||
<script type="text/javascript" src="https://widget-cdn.preezie.com/production/preguide.min.js" data-widgetid="123456789" data-targets="section-header" data-isafter="true"></script>
<script>
window.document.dispatchEvent(new Event("DOMContentLoaded", {
bubbles: true,
cancelable: true
}));
</script> |
Now add a trigger to your tag (e.g. Initialization) which initialises on the pages where you want your journey(s) to sit. Repeat this process for any additional pages.
Info |
---|
Do not initialise the snippet on all pages, only on the pages which you want journey(s) on. |
...
Example trigger
Set Initialization > Some Initialization Events. In the dropdowns select the following:
Page URL
contains
Page URL that matches your order confirmation
Final setup should look simiar similar to this:
...
Exit Intents, Popups & CTAs
This works in the same way as the Embedded version above but does NOT need data-targets element for page positioning, page positioning/triggers can be done via the preezie CMS.
You can obtain the code snippet from the CMS > Popups > Settings > Code Snippet:
...
Then add the additional code below the snippet, so it looks like this:
Code Block | ||||
---|---|---|---|---|
| ||||
<script type="text/javascript" src="https://widget-cdn.preezie.com/production/preguide.min.js" data-widgetid="123456789"></script>
<script>
window.document.dispatchEvent(new Event("DOMContentLoaded", {
bubbles: true,
cancelable: true
}));
</script> |
Add a trigger to this tag as above, this tag can be loaded on all pages as popups are controlled via preezie CMS instead. See this guide.
...
Initial Setup (full code snippet version)
Below is another version of the code snippet if your platform requires this level of control instead.
Replace
INSERT_CLASS_TARGET
orINSERT_ID_TARGET
with the class/id you'd like your widget to sit inside on your page. IMPORTANT: please only replace one of the target strings, never both.This will set the widget inside the first class or id which matches the name. If you would like the widget to sit under the target element instead, please change
targetElement.innerHTML
totargetElement.outerHTML
.
...
Code Block | ||
---|---|---|
| ||
<script type="text/javascript" src="https://preeziecdn.azureedge.net/production/preguide.min.js"></script> <script defer type="text/javascript"> var targetElement = document.querySelector(".INSERT_CLASS_TARGET") || document.getElementById("INSERT_ID_TARGET") ;(function () { if (!targetElement) return targetElement.innerHTML += '<div id="preezie-widget-div-id"></div>' PREEZIE_GUIDE.render([ { guideKey: "PUT YOUR OWN GUIDE KEY HERE", version: "1.0.0", renderTo: "preezie-widget-div-id", } ]) })() </script> |
Example Image:
...
Multiple Journeys On A Page
...