A TrustPrize "Popup Box" competition can be set-up to show only on specific pages by enabling and setting the URL matching rules in the competition's "Settings" screen.

These rules are matched against the current page's window.location.href property, which contains the complete URI (from protocol schema, up to and including the fragment hash). This enables you to match on any part of the URI you desire.

Furthermore, these rules may be simple strings, but also full Regular Expression, which will give you tremendous flexibility in expressing the conditions to allow the opt-in to show.

Tip: The regular expressions must be written as simple strings (i.e. "^pattern$"); remember that the JS literal notation (i.e. /^pattern$/) is not supported.

Here are some useful rules

  • example.com/?([?#].*|$)
    only match the root page of your domain (i.e. "example.com") regardless trailing slash, query strings of hash fragments;

  • example.com/some/page/?([?#].*|$)
    only match the /some/page` location regardless trailing slash, query strings of hash fragments;

  • [?&]special_key=(12|17)([&#]|$)
    only match if the query string contains parameter "special_key" with value 12 or 17;

  • #.*secret-key
    only match if the hash argument contains the text "secret-key" anywhere in its contents;

We're using the core JavaScript regular expression engine provided by all mainstream browsers, there the specific features are supported. See this cheat-sheet on the Mozilla Developer Network for a quick reference.

Did this answer your question?