Home > Shopify Development > generate the "How did you hear about us" form field

How to generate the "How did you hear about us" form field in Shopify

Sam Nguyen
Sam Updated: March 20, 2024

Share:

Drive 20-40% of your revenue with Avada
avada email marketing

Gathering valuable customer insights is essential for refining your marketing strategies and understanding your audience better. One effective way to achieve this is by adding a “How did you hear about us” form field in Shopify. In this guide, you’ll learn the steps to generate this field and easily implement it into your store for better customer tracking.

How to generate the “How did you hear about us” form field

The way to create the “How did you hear about us” form field

Please note that this section’s guide is for both sectioned themes and non-sectioned themes.

Step 1:

Go to Online Store > Themes from your Shopify Admin panel. Or choose the theme that you need to adjust and click Actions > Edit code.

How to generate the how did you hear about us form field in shopify

Step 2:

In the Snippets directory, tap Add a new snippet.

Step 3: Generate the snippet:

a. Name it hear-about-us.

b. Tap Create snippet.

How to generate the how did you hear about us form field in shopify

Step 4:

Please paste this code in your nre hear-about-us snippet.

Step 5:

Tap Save.

How to include the form field in the cart template

For sectioned themes

Please follow this instruction step by step:

1. In the Sections directory, choose cart-template.liquid. In case your theme does not include a cart-template.liquid, please tap cart.liquid in the Templates directory.

How to generate the how did you hear about us form field in shopify 2. Search the closing </form> tag in the code. Please paste the code given below on a new line above the closing </form> tag:


   {% include 'hear-about-us' %}

3. Tap Save.

For non-sectioned themes

Please follow this instruction step by step:

1. In the Templates directory, choose cart.liquid.

2. Search the closing </form> tag in the code. Please paste the code given below on a new line above the closing </form> tag:


   {% include 'hear-about-us' %}

3. Tap Save.

Customize the options in the “How did you hear about us” drop-down menu

To configure the available options, you are able to make changes to the code in your hear-about-us.liquid snippet.

1. In the Snippets directory, tap hear-about-us.liquid.

2. Search the first line of the code:


{% assign choices = "Facebook, Twitter, Google, Best Toys Bulletin, John Doe" %}

Add more or delete options, separated by commas.

3. Tap Save.

Conclusion

Taking the time to generate a “How did you hear about us?” form field on your Shopify store is a valuable step toward improving your marketing strategy. By following the simple steps outlined in this guide, you can easily implement and customize this form to gather insights from your customers. Apply what you’ve learned today to start making data-driven decisions that will enhance your store’s growth and customer reach.


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.

Stay in the know

Get special offers on the latest news from AVADA.