If you would like to target users based on the previous page they have visited, you can do so by using the document.referrer. You can add the document.referrer for targeting by adding it as a custom variable to your Usabilla for Websites implementation.
Adding the document.referrer
Before getting started, first check with your Customer Success Manager to confirm your website does not block this functionality. The document.referrer, for example only works for multi-page websites, so this means that it does not work for Single Page Applications.
Why you should add the document.referrer
Why would you want to target users based on their previous page? As possibilities are endless, here are just some of the things you can achieve with this targeting option.
- If your user is in the booking flow, but navigates to another section of the website: Ask the reason they left the booking flow, if they need help or offer a discount promotion code.
- If a user first visits a certain page, then heads directly to the FAQ or Help Desk Page: Ask them if any information is missing on the page or ask why they visited the FAQ page or Help Desk Page.
- If your user takes an alternative journey: Notify them with a Recruit Participants campaign and help redirect them to the right path.
How to set it up
1. First, decide which page you would like the campaign to show on and add this page's URL as a target URL.
2. Then decide on the page you want your user to come from (the previous page the user was on). This information is stored in the document.referrer variable.
Don’t forget to Save the changes you’ve made.