Skip to main content
All CollectionsIntegrationsGoogle Tag Manager
How to use Google Tag Manager to trigger ConvertFlow in single-page apps
How to use Google Tag Manager to trigger ConvertFlow in single-page apps

How to use Google Tag Manager to trigger ConvertFlow in single-page apps

Jonathan Denney avatar
Written by Jonathan Denney
Updated over a year ago

Some websites, often called single-page apps (SPA), don't fully reload when navigating between pages.

To have ConvertFlow detect the page change, you'll need to add the convertflow.start() function for ConvertFlow's JavaScript API, to tell ConvertFlow the page has changed and it needs to recheck campaign targeting conditions.

Google Tag Manager does a great job at detecting single-page app page changes with its "History Change" trigger, so we can use Google Tag Manager to fire the ConvertFlow JavaScript API call whenever the page history changes, even if the page doesn't fully reload.

To set this up, add another GTM "Custom HTML" tag, that is separate from ConvertFlow's install script. Paste the script below in the HTML field:

<script>   
if (window.convertflow) {
convertflow.start();
}
</script>

Then, add the trigger called "Page History Change" to the tag. Save and publish the tag.

Assuming ConvertFlow is installed, GTM will now run that JavaScript API call whenever the page URL changes, even if it doesn't fully reload.

Did this answer your question?