Identifying users and triggering events using HubSpot

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:
www website is supported!
Advanced URL is
https is supported!

Adding the snippet to the page to record the page view and initiate the journy() function

Add the following code on top of the <body section> of your form page:

<script src="" async></script>
journy("init", { trackerId: "**your-journy-ID**", domain: "" });
journy("pageview"); /*record the page view! */

You'll need to change your-journy-ID to your. actual journy-ID, and your Advanced URL to your own as well.
But the simplest way is to copy-paste the whole code from your business setting menu.

Identifying visitors and/or triggering event when submitting Instapage forms.

Add the following code in the <Footer section> of your form page:

window.addEventListener('message', event => {
if ( === 'hsFormCallback' && === 'onFormSubmit' &&
) {
journy("event", { tag: "HubSpot-Form-Submit" });
var emailField = {
return === "email";
if (emailField) {
journy("identify", { email: emailField.value });

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