Prerequisites
- A TruGen agent with an
agent_id: see the quickstart - Access to your Shopify admin with theme edit permissions
Add via Custom Liquid section (recommended)
1
Open the theme customizer
In your Shopify admin, go to Online Store → Themes → Customize on your active theme.
2
Add a Custom Liquid section
On the page where you want the agent to appear (Home, Product, or Custom page), click Add section and choose Custom Liquid.
3
Paste the iframe
YOUR_AGENT_ID with your agent ID. Shopify’s Liquid variables (customer.first_name, customer.id) auto-inject the shopper’s identity for personalization.4
Save and preview
Save the section. Preview the page in an incognito window to test as a real shopper.
Add via theme code edit (advanced)
For sitewide floating widgets, edit the theme’stheme.liquid:
1
Open theme code
Go to Online Store → Themes → Actions → Edit code.
2
Edit theme.liquid
Open
layout/theme.liquid and add the iframe before the closing </body> tag:Domain allowlist
If your agent usesallowed_domains, add your Shopify domain, both your custom domain (e.g., mystore.com) and the default .myshopify.com domain, to the list.
Content Security Policy note
Shopify’s default CSP is permissive enough to load third-party iframes. If you’ve customized it via a checkout script or theme edit, ensureframe-src https://app.trugen.ai is included.
What’s next
iFrame reference
Every iframe parameter documented.
Prompting for e-commerce
Write a shopping-savvy system prompt.