Identifying users and triggering events using WebFlow

Requirements before proceeding.

In general, to understand how to identify visitors and to trigger events, please visit: How to set journey properties in JS

We'll further assume the following:
website: site.com
www website is supported! www.site.com
Advanced URL is track.site.com
https is supported!


Adding the snippet to the page to record the page view

Paste this in Page Settings > Custom Code > Header Code:

<script src="https://track.site.com/tracker.js" async></script>
<script>
window.journy=window.journy||function(_,n,o){window.__journy_queue__||(window.__journy_queue__=[]),window.__journy_queue__.push({command:_,args:n,date:Date.now(),callback:o})};
journy("init", { trackerId: "your-journy-ID", domain: "https://track.xantopia.net" });
journy("pageview"); /*record the page view! */
</script>


You'll need to change your-journy-ID to your... actual journy-ID...but you can simply copy-paste the whole code from your journy.io business setting menu.

Identifying visitors when submitting WebFlow forms.

Paste this in Page Settings > Custom Code > Footer Code:

<script>
function getParam(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); }
Webflow.push(function() {

$("#RequestDemoButton").click(() => {
const inputEmail = $("input[type=email]").val()
if(inputEmail) {
console.log("Submitted " + inputEmail);
journy("identify", { email: inputEmail, score: 25 }); /*identifying the user! */
journy("event", { tag: "WebFlow Form Submit" }); /*trigger an event! */
}
})
</script>


You need to set the page recording snippet before being able to identify a visitor or trigger an event!
Was this article helpful?
Cancel
Thank you!