Shopify Integration
Add AI Search Index to your Shopify store to track AI bot visits.
Installation
1
Open Theme Editor
From your Shopify admin, go to Online Store → Themes → Edit code
2
Open theme.liquid
In the Layout folder, click on theme.liquid
3
Add the script
Add the following code just before the closing </body> tag:
theme.liquid
<!-- AI Search Index Tracking Pixel -->
<script
src="https://www.aisearchindex.com/pixel.js"
data-tid="YOUR_TRACKING_ID"
async
></script>
<noscript><img src="https://www.aisearchindex.com/api/pixel?tid=YOUR_TRACKING_ID" width="1" height="1" style="position:absolute;left:-9999px;visibility:hidden" alt="" /></noscript>
</body>4
Save
Click Save to apply your changes.
About SPA Mode
Standard Shopify stores use full page reloads for navigation, so SPA mode is not required. Each page load will be tracked automatically.
Alternative: Using Shopify Sections
You can also create a custom section for the tracking pixel. This makes it easier to enable/disable tracking from the theme customizer.
sections/ai-search-index.liquid
{% if section.settings.enabled %}
<script
src="https://www.aisearchindex.com/pixel.js"
data-tid="{{ section.settings.tracking_id }}"
async
></script>
<noscript><img src="https://www.aisearchindex.com/api/pixel?tid={{ section.settings.tracking_id }}" width="1" height="1" style="position:absolute;left:-9999px;visibility:hidden" alt="" /></noscript>
{% endif %}
{% schema %}
{
"name": "AI Search Index",
"settings": [
{
"type": "checkbox",
"id": "enabled",
"label": "Enable tracking",
"default": true
},
{
"type": "text",
"id": "tracking_id",
"label": "Tracking ID",
"info": "Find this in your AI Search Index dashboard"
}
]
}
{% endschema %}Then include the section in your theme.liquid:
{% section 'ai-search-index' %}Verify Installation
- Visit your Shopify store
- Open Developer Tools (F12)
- Go to the Network tab
- Look for a request to
pixel.js - Check your AI Search Index dashboard for incoming data