How to use return URLs?

Setting up return URLs to control redirections at the end of the action.

Alexandre Santini avatar
Écrit par Alexandre Santini
Mis à jour il y a plus d’une semaine

By integrating Poool solution on your website, the return URL issue will most likely arise. But don't panic! Here we give you every useful information about it.

Why set up a return URL?

Return URLs are very useful, especially when a subscriber connects while reading an article. After login or subscription, the reader is directly redirected to the page or article from she/he comes. This is very useful to maintain an optimal user experience!

How to set up return URL?

To set up a "return URL", you have to pass an URL parameter on each URL where there is a need to go back. There are two ways to do that:

First:
Putting the following parameter ?return_url={return_url} at the end of the URL in the widget creation or settings:

Note: {return_url} is actually a Javascript shortcut function "window.location.href", which allows to recover the URL of the current page.


Second:
Directly in your code, adding the parameter at the end of the URL affected:

poool("config", "subscription_url", "http://mysite.com/subscribe?return_url=" + window.location.href);

⚠️ Attention ⚠️ 

Both of these solutions involve that you have recovered by yourself the URL information and redirected it on the server or in Javascript in the right moment (post-login or post-registration). Without that, there will be no redirection 😊.


If you need more information about it, you can contact us on Intercom!

Avez-vous trouvé la réponse à votre question ?