Tracking via Single Page Apps

If your website is a Single Page App then you may need to configure and use the JS Tracker in a slightly different way from the standard approach.

Identifying the Logged In User

As per the instructions to identify your user, please continue to set the onboardFlowSettings dictionary as outlined in that guide. However, please note that by default the identity of the logged in user will only be sent to OnboardFlow on the initial page load. This might be fine for some, but if you are operation a single page app, you are likely going to need to trigger an update of the users identify as various other points within your app. For example, if the user changes their plan, name or email, you will probably want to trigger the updateIdentity method to let OnboardFlow that something about the logged in user has changed and it should therefore be recorded. The same applies if any of their Custom Properties have changed.

To manually update the identity of the logged in user, you will need to call the following method:

OnboardFlowLoader.updateIdentity(window.onboardFlowSettings);

Tracking Page Views

If your Single Page App triggers the hashChange event when a page is changed, then OnboardFlow will detect page changes automatically. However, if you do not trigger this event, you will need to manually call the logPageView() event whenever a page changes. For example:

OnboardFlowLoader.logPageView(); 

Please make sure that you have identified the logged in user, before triggering a page view otherwise the page view will not be logged.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.