Capture Page Path Data in a Website Intercept Survey

Website Intercept is available as an add-on. If you are interested in Website Intercept, please contact us for additional information.

Website Intercept

Using HTTP Referrer

Knowing which page a visitor was on when they responded to an Intercept survey can be very helpful. This contextual information can take what would otherwise be vague or general feedback, and make it much more actionable. Capturing the page a visitor was on when they took your Intercept survey is quite easy, with the help of a special merge code.

[system("referrer")]

Simply put this merge code in to a Hidden Value action in your Intercept survey, and you will then know exactly which page any given response came from!

Capturing recent pages visited

The most recent page is a start, but to get even more contextual information, why not capture all of the most recent pages they have visited! Website Intercept beacons actually do this by default, recording a visitor's page path history for all of the pages where you have installed your beacon.

Please note that cookie size limitations restrict this to the last 10 pages visited, up to 2000 characters of data. Additionally, the most recent page path does not get pushed to the cookie right away, and so it is recommended to still use the HTTP referrer to see the last page a visitor was on.

Because this information is stored as a cookie though (named _sg_b_p), it is very easy to access and include as Custom Data! The following snippet includes a simple JavaScript function that pulls the requested cookie name, and includes it as Custom Data.

Include this code right after your beacon 'init' call, and then set up some way to capture this inside your Intercept survey. This would most easily be done just like how you would capture HTTP Referrer, using a Hidden Value action with a URL merge code inside.