Locksmith
Install LocksmithContact us
  • Quick Start
  • 💡Basics
    • A Locksmith Overview
    • Creating locks
    • Creating keys
    • Compatibility with other apps and Shopify features
    • Removing Locksmith
  • 🔆Tutorials
    • Approving customer registrations
    • Creating restricted wholesale products
    • Hiding product prices and/or the add to cart button
    • Selling digital content on Shopify
    • More tutorials...
      • Setting up multiple price tiers
      • Customizing messages
      • Customizing the customer login page
      • Customizing the registration form
      • Customizing the passcode form
      • Customizing Locksmith’s "Access denied content" messages, and redirecting customers
      • Customizing the email list signup form
      • Showing multiple prompts on the same page
      • Showing content only to specific Markets
      • Input lists
      • Protecting against bots
      • Earn recurring revenue on your exclusive content using ReCharge
      • Use Locksmith and PayWhirl together to grant access based on subscriptions
      • Liquid locking basics
      • Restricting checkout from the cart
      • Confirmation key condition
      • Restricting customers to a specific collection
      • Passcode-specific redirects
      • Grow your subscriber lists with Klaviyo
      • Use Klaviyo as an access control list
      • Use Mailchimp to collect customer emails
      • Hiding out-of-stock products
      • How to use a private browsing session
      • Granting access to variants by visitor input
      • Offering different variants by postal code
      • Locking products by tag
      • Locking multiple pages at once
      • Making a product accessible exclusively from the direct product link
      • Creating private team areas
      • Importing customers in bulk
      • Disabling Locksmith for certain theme files
      • Adding translations to your Locksmith messages
      • Redirecting using Locksmith
      • Locking variants
        • Limiting the scope of variant locks using the product tag key condition
        • Handling JavaScript DOM errors caused by variant locks
      • Locking the customer registration form
      • Locking the search results page in your store
      • How to clear cache for a single website
      • Disabling Locksmith for certain theme files
      • 🛠️Manual mode
      • Grant access for a limited time when using passcodes or secret links
      • Testing Locksmith on unpublished themes
      • Locking blog posts
      • How to access your browser's dev tools
      • Restricting the cart for mixed products and combinations of products
      • Locking products by vendor
      • How do I hide my Shopify store's header and footer
      • Hiding navigation links for locked resources
      • Hiding products from product-grids
      • Restricting a product so that it can only be purchased by new customers
      • Automatically managing the seo.hidden metafield using Locksmith
      • Locking the home page
      • Setting up checkout validation with Locksmith
      • How to hide theme sections, blocks, and snippets
  • 🔑Keys: Access methods in Locksmith
    • About key conditions
    • Customer account keys
    • Passcode keys
    • Secret link keys
    • Visitor location keys
    • More about keys...
      • Inverting conditions in Locksmith
      • Combining key conditions
      • "Has purchased..." key
      • Using the "Force open other locks" setting
      • Liquid key basics
      • Manual mode
      • Excluding content from locks
      • IP address keys
      • Newsletter keys
      • Limiting the scope of variant locks using the product tag key condition
  • 🌻FAQs
    • Why aren't my locks working?
    • FAQ: I see blank spaces in my collections and/or searches when locking
    • Can Locksmith hide content from my in-store search?
    • Locksmith is not working with my page builder app
    • What should I do if my site is loading slowly?
    • I'm the administrator of my site and I cannot access pages because of Locksmith locks.
    • More FAQs...
      • I'm having trouble using Locksmith with a site speed optimization app.
      • The app isn't loading. What do I do?
      • Can Locksmith protect shipping methods, billing methods, or coupon codes?
      • I switched themes, and Locksmith isn't working
      • Why isn't my passcode, secret link, newsletter, or location key working?
      • Can Locksmith lock Shopify's public JSON API for my online store?
      • Why are my customers seeing a reCAPTCHA when logging in?
      • My passcode or newsletter prompt is not updating on my store when I change it.
      • My featured collections on my home page only show one product.
      • My infinite scrolling doesn't show all of my products.
      • My customers have to enter their e-mail address into the Mailchimp key every time they visit.
      • How do I know which customers have used a certain key?
      • Why is Locksmith adding information to my orders?
      • Locksmith isn't installing correctly!
      • Locksmith is not uninstalling correctly!
      • How does Locksmith affect search engines and SEO?
      • How do I change where customers are redirected to after registration on Shopify
      • The thing I want to lock isn't showing up in the Locksmith search
      • I am getting an "already taken" error when trying to create a metafield definition for seo.hidden
      • How do I add a hero banner image to Locksmith's access messages
  • 📒Policies
    • Usage agreement
    • Locksmith's pricing policy: Pay what feels good
    • Privacy policy
    • Data policy
    • Contact us
  • 🔦Developer Tools
    • Locksmith Admin API
    • Locksmith Storefront API
    • Locksmith variables
    • Unsupported functionality
    • Requests from Locksmith
  • More developer docs...
    • Using the Admin API with Locks
  • App Integrations
    • Easy Appointment Booking
Powered by GitBook
On this page
  • Setup
  • Secret link types
  • How secret links work
  • Secret link formatting
  • Usage notes
  • Returning visitors
  • Re-using secret link codes
  • Using a vendor's referral link as a secret code
  • Restricting where locked content is revealed
  • Some things to be mindful of when sending customers secret links

Was this helpful?

Export as PDF
  1. Keys: Access methods in Locksmith

Secret link keys

PreviousPasscode keysNextVisitor location keys

Last updated 1 month ago

Was this helpful?

Note: Some marketing and email services (such as Klaviyo or Mailchimp) may automatically add tracking information to the end of a URL to monitor clicks or other metrics. This code will also need to be separated from the secret link's extension code using an ampersand (&). See the of this guide for more information.

Testing: We strongly recommend testing your secret links in the same manner they will be sent to customers before launching a marketing campaign or exclusive sale. This ensures that customers receive a functioning link. See our guide that covers testing troubleshooting tips below: Why isn't my passcode, secret link, newsletter, or location key working?

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.

Setup

To configure a secret link, start by creating a lock (If you need more information on creating a lock, ).

Then, in the lock settings, follow the prompts to create a secret link key:

Secret link types

Regular secret links

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).

Secret links from an input list

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:

How secret links work

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:

Secret link formatting

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/?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

Please note that the secret link must use URL-friendly characters in order to be evaluated correctly.

Acceptable characters are:

  • Alphanumeric: 0-9a-zA-Z

  • Special characters: $-_.+!*'()

Usage notes

Returning visitors

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. Try using a new private browsing session to test for that.

Note: removing a secret link from a lock, or changing a secret link's extension code will revoke access for any customers who used the original secret link.

Re-using secret link codes

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.

Using a vendor's referral link as a secret code

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 "query string" 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:

Restricting where locked content is revealed

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.

Some things to be mindful of when sending customers secret links

  • It "ls=" hasn't been included at the beginning of the secret link code. A secret link code can still work without this, but if a customer is visiting your store for the first time, Shopify may be unsure of what the code at the end of the URL is doing and could redirect customers to the homepage before the lock is opened. This might make it appear as though the secret link isn't working. However, a second attempt usually succeeds. Including "ls=" at the beginning of the secret link code should prevent this issue.

  • If you're sending out a marketing email or similar communication, make sure to test the email first. Sometimes the wrong or incomplete secret link can be added, or the marketing email can unexpectedly modify or add additional information to the URL.

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. . To use the input list version, select it instead of the regular secret link key condition type.

The secret link key condition also has a "Grant access for a limited time" option that can revoke a customer's access after a set amount of time passes from initial use. Details on using this option are here:

If additional information is being added to the URL, ensure that it is separated from the secret link code using an ampersand (&). This allows Locksmith to differentiate the secret link code from other information. See the of this guide for more information.

🔑
Go here for information on setting up input lists
Grant access for a limited time when using passcodes or secret links
Secret link formatting section
start with our guide here
Secret link formatting section
This image shows you how to quickly create a single secret link.
Example: adding a referral link URL's querystring to the Secret Link key