Auto redirect on form completion

Hi,

I would like to auto-redirect the users who finish my form.

For tracking purposes, I would like to redirect them while including some of their answers, just like that redirect button in the “thank you” option in the script allows to do. However, I would like this redirection to happen without the click on the button.

Is there any way to do this? That would solve the biggest gap in my tracking…

Best,
Laurent

1 Like

Hi Laurent,

We usually recommend ‘Thank you’ question for this purpose. As redirection happens only on user action (Button click) it will be a good and predictable user experience.

But if you insist on auto-redirect, it is possible using our developer javascript API. Few lines of code on your website can do the job.

The additional javascript code will look something like:

var collectchat = window.collectchat || {}; 
collectchat.ready = function() {
    collectchat.on('complete', function(list) {
       window.location.href = 'https://redirect.com';
    });
}

Have a look at https://developers.collect.chat/#/callbacks?id=collectchatonevent-function for more info on this.

I recommend consulting a developer to implement this if you are not one.

Let me know how it goes.

Cheers,
Shyjal

Hi Shyjal,

Thank you for your answer. I am doing this because I need to link the chat to the pardot cookie. As the chat is sent on your domain, it doesn’t link.

For it to link, I have to redirect the user to another page that contains “?pi_list_email=“useremail”” .

That’s why I need it to be an auto redirect, as impractical as it is for the user.

Thank you for this documentation, but it doesn’t seem to explain how to pull values. Is that a possibility?

Best regards,
Laurent

Okay, got it.

It is possible to pull values as a function parameter of on complete callback. You can console.log the list parameter in the above code and see the data.

Thank you shyal, with your information I was able to make it work !

For anybody out there looking to do the same thing, here is what I added to the code :slight_smile:

if (current.question === “COLLECTCHATIDOFYOURQUESTION”) {
email = current.answer;

and at the redirect part:

collectchat.on(‘complete’, function(list) {
window.location.href = 'http://yoururl.com"+email;
});

Console logs are needed as Shyjal mentioned in order to get your question ID.

Best,
Laurent

2 Likes