Trigger Convert polling when URL hash changes

Issue Description

Convert experiments do not start when the URL has a hash.

For example:

A website homepage loads with the following URL:

https://domain.com/

After clicking on a link the page loads something like this:

http://domain.com/#features

But, if we setup an experiment with that URL, and the user, does not load that URL as the first visit to the site, the experiment will not trigger. 

This is a common issue of single page apps (SPAs).

Solution

Just add the following code to the Project Global JS section of your project.

convert.$(document).ready(function () {
convert.$(window).on('hashchange', function () {
_conv_q = _conv_q || [];
_conv_q.push(["run","true"]);
});
});

Note: Please test it with your SPA framework, as it might not detect hash changes in all frameworks.

Need assistance? Start a conversation with our Support Team.
CONVERT MORE

Reliably Convert More Site Visitors, Even If Everything Else is Changing in Your Business.

START 15-DAY FREE TRIAL
✓ No Credit Card  ✓ Easy Set-Up  ✓ Access All Features

Comments