CMS Platforms
Shopify Installation
Protect your Shopify contact and newsletter forms by adding the UCAPTCHA script to your theme.
Step 1 â Get your site key
Log in to your UCAPTCHA dashboard, go to My Sites, and copy the site key for your site.
Step 2 â Open the Theme Code Editor
- In your Shopify Admin, go to Online Store â Themes
- Next to your active theme, click ⯠â Edit code
Step 3 â Add the script to theme.liquid
- In the file tree on the left, find and open Layout â theme.liquid
- Find the closing
</head>tag (use Ctrl+F / Cmd+F to search) - Paste the following snippet just before the
</head>tag. ReplaceYOUR_SITE_KEYwith your actual key.
<script
src="https://www.ucaptcha.site/captcha-widget.js"
data-site-key="YOUR_SITE_KEY"
defer>
</script>- Click Save
Step 4 â Verify it's working
Visit your Shopify store's Contact page (usually at yourstore.com/pages/contact). The UCAPTCHA checkbox should appear inside the contact form automatically.
đĄ Shopify's built-in contact form and newsletter signup form are both supported. If you're using a third-party form app, check the app's documentation for how to add custom scripts to its form output.
Targeting specific pages only (optional)
If you only want UCAPTCHA on your contact page and not site-wide, you can use Liquid's template conditionals in theme.liquid:
{% if template == 'page.contact' %}
<script
src="https://www.ucaptcha.site/captcha-widget.js"
data-site-key="YOUR_SITE_KEY"
defer>
</script>
{% endif %}Replace page.contact with the template name of the page you want to protect. You can find the template name by looking at the page in the theme editor.
âšī¸ Common Shopify template names:
page.contact for the contact page, index for the home page, collection for collection pages.