Landing Page Personalization: URL Parameter, Referrer and Cookie Criteria

Not every visitor should see the same thing. A visitor landing from your email campaign might deserve a special offer, while someone arriving from a partner website should see a tailored welcome. Restrict for WordPress ships with three visitor-based restriction criteria that make this kind of landing page personalization easy — no membership or login required.

The three visitor-based criteria

  • Visitors arriving with a URL parameter — the content is shown only when the visitor’s address contains a given URL parameter, for example yoursite.com/offer/?src=newsletter. Perfect for email campaigns, ads and QR codes.
  • Visitors arriving from a specific website (referrer) — the content is shown only to visitors coming from a website whose address contains the text you enter (for example facebook.com).
  • Visitors with a specific cookie — the content is shown only to visitors carrying a specific cookie, which is handy for returning visitors, consent-based content or integrations with A/B testing tools.

Restricting a whole page or post

While creating a new or editing an existing page or post, locate the Content Available To dropdown below the content area and pick one of the new criteria:

  1. Select Visitors arriving with a URL parameter, Visitors arriving from a specific website (referrer) or Visitors with a specific cookie.
  2. Fill in the fields that appear. For the URL parameter criteria, enter the Parameter name (i.e. src) and optionally the Parameter value (i.e. newsletter). For the referrer criteria, enter the text the referrer should contain. For the cookie criteria, enter the Cookie name and optionally the Cookie value.
  3. Update the page or post. That’s it!

Visitors who don’t match the criteria will see the restriction message instead of the content.

How the matching works

  • If you leave the value field empty (for the URL parameter and cookie criteria), the mere presence of the parameter or cookie is enough for the visitor to qualify.
  • The value comparison is case-insensitive, so ?src=Newsletter and ?src=newsletter are treated the same.
  • The referrer criteria checks whether the address of the website the visitor is coming from contains the text you entered. Note that browsers may omit the referrer entirely (direct visits, bookmarks, some privacy settings) — in that case, the visitor is treated as not matching the criteria.

Restricting just a part of the content (premium)

With the premium version of Restrict, the same criteria are available in the content restriction shortcode. Ready-made shortcode generators can be found in the Shortcodes area of the plugin settings. A few examples:

[rsc_restrict_content allowed_to="url_parameter" url_parameter_key="src" url_parameter_value="newsletter"]Content for the newsletter visitors[/rsc_restrict_content]
[rsc_restrict_content allowed_to="referrer" referrer_contains="facebook.com"]Content for the visitors coming from Facebook[/rsc_restrict_content]
[rsc_restrict_content allowed_to="cookie" cookie_name="my_cookie" cookie_value=""]Content for the visitors with the cookie[/rsc_restrict_content]

Just like with the other criteria, you can add a custom message for ineligible visitors with the protected_message argument. The same three criteria are also available in the Restrict panel of the block editor (Gutenberg) in the premium version, so you can show or hide any individual block based on the visitor’s source.

A note about caching

These criteria are evaluated on the server for each visit. If your website is served from an aggressive full-page cache (server or CDN level), the referrer and cookie criteria may show a cached variant of the page. The URL parameter criteria generally plays nicely with page caching, since URLs with query strings typically bypass the cache.

Related documentation