Secret link keys
In Locksmith, a "secret link" is a Shopify URL that contains a "secret code" on the end of it, like this:
https://example.com/products/example?ls=FoO-rNBaTquJgqh1tbXjEQ
When a locked resource has a secret link key, only visitors who arrive via that link will be able to view the resource. This makes secret links useful for secret sales, or for offering specific products that are only available via certain ad campaigns.
To configure a secret link, start by creating a lock (If you need more information on creating a lock, start with our guide here).
Then, in the lock settings, follow the prompts to create a secret link key:

This image shows you how to quickly create a single secret link.
This will generate a single secret link for you that can immediately copy and use. You can also enter a custom secret link code if preferred. The setup is very straightforward (shown in the screenshot above).
It is also possible to use secret links in conjunction with our input list feature. Input lists allow you to store a list of links in a google sheet or other outside file source. This is great for merchants that want to easily create a large list of unique secret links that can be used. Go here for information on setting up input lists. To use the input list version, select it instead of the regular secret link key condition type.
Input lists also allow you to create usage limits on your secret links (usage limits are not possible for the single secret link option). So, for example, you could create a large list of secret links that could each only be used one(the input list guide, link just above, gives more information on setting this up). Or, you could simply add in a single secret link with a large usage limit.
To use the input list version of the secret link key, select it from the key dropdown:

Secret links consist of two parts:
- The secret link code (top box): This is the "secret" part of the link, which you can change to whatever you like.
- The full secret link (bottom box): This is the link you send your customers, or whoever should see the locked content. It's the regular URL for your locked content, with the secret link code appended to it. Click the copy button to copy to your clipboard.
Want your link code to be something different? You can simply change that, and it will update the full link:

It's important to note that the secret link code must be an exact match in order to work. If the customer accidentally adds a character to the end of that link, they won't get access.
Having said that, there is some flexibility on how the URL is constructed. The secret link code can be presented in several, valid ways, illustrated here:
- https://example.com/?MYSUPERSECRETLINK
- https://example.com/?ls=MYSUPERSECRETLINK
- https://example.com/?another_parameter=ABC123&ls=MYSUPERSECRETLINK
- https://example.com/?ls=MYSUPERSECRETLINK&another_parameter=ABC123&...
- https://example.com/products/my-product?variant=32213744255111¤ty=USD&ls=MYSUPERSECRETLINK
Once a visitor arrives via a secret link, Locksmith will remember their access for a while. If you're testing, this can make it look like the key is no longer working. For more on this, see Why isn't my passcode, secret link, or newsletter key working?.
If you've got several secret link keys, across different locks, any keys that re-use the same secret code will all be activated when one link is used. This way, you can unlock several pieces of content across your store, using only a single secret link.
If you're using a referral service (or any other service that generates a URL with a specific code at the end), you can use the referral URL's "querystring" as the secret code for your key.
For example, if you're using a referral URL that looks like https://example.com/?rfsn=abc123, you may set your secret link code to "rfsn=abc123", and your Locksmith key will Just Work™.
If your lock has been configured for resource hiding, the successful use of a secret link will reveal the hidden resource across your online store. If you'd like to make sure that your locked product (for example) can only ever be viewed on its product page, and never via store search or collection listings, add a second condition to your key which limits the key's usage to only the product page.
To do this, use the "and..." link next to your existing key, and select the "(custom Liquid)" option. Fill in the Liquid condition with request.page_type == "product", as shown below.

The result: your secret link key will continue to work normally, but the access afforded by the key will only work when the visitor is literally on a product page. This means that the key will not kick in when the visitor is (for example) looking at search results, which means that the product will remain hidden in those places.