Table of contents

How to Display Smart Content to Anonymous Site Visitors Based on HTTP Request

While your site visitor may be anonymous, the incoming HTTP request contains a trove of information about how the visitor found you (i.e. URL used to access your page, including path and query, and IP address).

To personalize the visitor's experience based on this information, write a simple IF/ELSE statement. Use IF to specify a block of code to be executed, if a specified condition is true. Use ELSE to specify a block of code to be executed, if the same condition is false.

You can read more on that here - HubL Syntax Reference - If Statement.

Below is some example code to get you started: 

Step 1

{% if request.referrer == "http://www.website.com?utm_campaign=name" %}

This is dynamic content. It is because the referrer was "http://www.website.com?utm_campaign=name which I specified in the code".

{% else %}

This is the default content I'm displaying because the referrer was something other than "http://www.website.com?utm_campaign=name"

{% endif %}