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 GetFeedback Digital for Web 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.
After you've received confirmation from your Customer Success Manager you will need to add the document.referrer to your GetFeedback Digital for Web Implementation. You can add the document.referrer as a custom variable using JavaScript. The example down below in the jsfiddle frame shows you how to do so. Make sure to initialize the JavaScript after the feedback button has been loaded.
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.
3. Using the Custom javascript value trigger, you simply type in referrer and then the URL of the page you want the user to come from “/products/”. You can add different rules such as is equal to or contains.
Don’t forget to Save the changes you’ve made.