Skip to main content

Save referral and campaign details to Shopify customers

Save a referral or campaign ID from the quiz link and add it to the Shopify customer as a tag or a customer metafield.

Written by Traian

Your quiz link can include extra information, such as a referral ID, affiliate code or campaign name. Lantern can read this information from the link and save it to the shopper’s Shopify customer record as a tag or customer metafield.
​

For example, a quiz link ending in ?referral=1234 can save the referral ID 1234 to the customer’s record. This lets you track who referred them, even if they don’t place an order.
​

The examples below use referral. Replace it with the parameter name you use in your links.

Before you start

Your quiz needs to collect an email address through the Optin Page or Email Sign-up on the Results Page.

You also need to enable Create Customer in Shopify, under Results Page → Order & Customer Tags. For more about creating customers, see Shopify Customers.

1. Choose which details to save from the link

1.1 Open your quiz in the Quiz Builder and select Results Page.

1.2 In the right-hand menu, open Order & Customer Tags.

1.3 Under URL Parameters, enter referral in Save these URL parameters. To save more than one parameter, separate their names with commas, for example referral, campaign.

1.4 Publish your quiz.
​

A shopper can now open a link such as:

https://your-store.com/tools/perfect-product-finder/your-quiz?referral=1234


When they answer the first question, Lantern saves 1234 under the name referral.


You can use that saved value by entering {{ referral }} wherever a Property ID is supported.To learn how Property IDs work, see How to use customer answers in Lantern quizzes.

2. Choose a tag or a customer metafield

You can save the value as a tag, a metafield or both.

Use

Best for

Example

Customer tag

Values shared by many customers, such as a campaign or traffic source

summer-campaign

Customer metafield

Referral IDs, affiliate codes or other values you want to keep in a named field

Referral: 1234

Tags accumulate. If a customer returns through a different referral link, they can receive another tag.

Metafields keep the first value. Lantern does not overwrite an existing customer metafield.
​
​

Add the value as a customer tag

2.1 Under Results Page → Order & Customer Tags, tick Enable customer tagging and Create Customer in Shopify.

2.2 In Customer tags, enter your tags, including the saved value. For example:

lantern, quiz, ref-{{ referral }}

2.3 Publish your quiz.

A shopper who uses a link ending in ?referral=1234 receives the tags lantern, quiz and ref-1234.


​

Image showing the Order and Customer Tags section of the Results Page settings in Lantern, with Enable customer tagging and Create Customer in Shopify checked, the customer tags set to lantern, quiz, ref-{{ credituser }}, and credituser entered under Save these URL parameters.
  • If the link has no referral value, the ref- tag is skipped. The other tags are still added.

  • If the shopper is already a Shopify customer, their existing tags are kept.

You can also use quiz answers in tags. For example, {{ skin_type }} adds the answer from the question with the Property ID skin_type. For multiple-choice questions, each selected answer becomes a separate tag.
​

Save the value in a customer metafield

A customer metafield stores information in a named field on the Shopify customer record.

2.4 Under Results Page, open Customer Metafields.

2.5 Enter the following:

Setting

Value

Metafield Namespace

custom

Metafield Type

single_line_text_field

Metafield Name

referral

Metafield Value

{{ referral }}

2.6 Publish your quiz.

  • If the customer doesn’t have this metafield yet, Lantern adds it.

  • If the metafield already exists on the customer, Lantern keeps its existing value.

  • If the link has no referral value, Lantern skips the metafield and still creates the customer.

To display the metafield on the Shopify customer page, or use it as a customer-list column or filter, create a matching definition under Shopify admin → Settings → Custom data → Customers. Use the same namespace, name and type.

Where to add the value in your link

The parameter must be in the URL of the page where the shopper takes the quiz.

For a quiz on its own page:

https://your-store.com/tools/perfect-product-finder/your-quiz?referral=1234

For an embedded quiz or a popup on a store page:

https://your-store.com/pages/find-your-product?referral=1234

If the shopper first visits another page containing the parameter and then follows a link to the quiz, the value is not carried over automatically.

Good to know

  • Lantern saves the value when the shopper answers the first question. Opening the quiz without answering does not save it.

  • Parameter names can contain letters, numbers, underscores and hyphens.

  • The names email, phone, name and marketing_consent are reserved and cannot be used.

Did this answer your question?