Before you begin
You need:- Admin access to your GA4 property (to create custom dimensions and channel groups)
- The Asva snippet installed on your storefront (see Surface Hidden AI Traffic with Asva Attribution)
- Your Asva Property ID from Dashboard → Settings → Property
Set up GA4 custom dimensions and reporting
Install the Asva snippet
If the snippet is not yet on your site, add it to your storefront The snippet sets:
<head>. The snippet automatically enriches page_view events with three parameters GA4 needs:| Parameter | Value example | What it means |
|---|---|---|
ai_source | chatgpt, gemini, perplexity | Which AI surface referred the session |
is_ai_session | true / false | Whether Asva classified the session as AI-sourced |
ai_confidence | 0.82 | Confidence score of the AI classification |
Create custom dimensions in GA4
GA4 does not recognise
For each dimension:
ai_source, is_ai_session, or ai_confidence automatically. You must register them as custom dimensions.Go to GA4 Admin → Custom definitions → Custom dimensions and create one dimension for each row below:| Dimension name | Scope | Event parameter |
|---|---|---|
| AI Source | Session | ai_source |
| AI Session | Session | is_ai_session |
| AI Session Confidence | Session | ai_confidence |
- Click Create custom dimension
- Enter the Dimension name from the table above
- Set Scope to Session
- Enter the Event parameter from the table above
- Click Save
Custom dimensions only populate for data collected after you save them. Historical sessions will not be backfilled, so create your dimensions before expecting to see data.
Add an AI Commerce channel group
Create a custom channel group so GA4 labels AI-sourced sessions as “AI Commerce” rather than “Direct”.Go to GA4 Admin → Channel groups → Create new channel group, then add the following rule:
- Session source/medium contains
ai - OR custom dimension AI Source is not empty
Build an AI Commerce Exploration report
Create a custom Exploration report to track AI commerce performance alongside your other channels.Go to Explore → Blank exploration and configure:Dimensions to add:
- Channel group (custom)
- AI Source
- Landing page + query string
- Sessions
- Conversions
- Conversion rate
- Total revenue
- Average order value
Verify data is flowing
Wait 24–48 hours after installing the snippet for session data to populate, then confirm the integration is working.Browser console check — open your storefront in a browser and run:GA4 DebugView check:
- Append
?asva_debug=1to any page URL on your store - Open GA4 → DebugView
- Look for
page_viewevents with theai_sourceparameter populated
- AI Commerce appears as a channel in your default channel group breakdown
- The AI Source dimension shows values like
chatgpt,gemini, orperplexity - Sessions with
is_ai_session = trueare visible in the Exploration report
Platform-specific setup
- Shopify
- Google Tag Manager
- Headless / custom
Add the snippet via Online Store → Themes → Edit code → Add
theme.liquid, inside the <head> block:asva_property_id as a theme setting in your settings_schema.json so you can update the ID without editing code.Troubleshooting
The AI Source dimension shows no data
The AI Source dimension shows no data
Custom dimensions only capture data from the moment they are created. If you created the dimensions after the snippet was already live, the data from sessions before creation is not backfilled. Wait 24–48 hours after creating the dimensions to see data appear.
AI Commerce does not appear in my channel report
AI Commerce does not appear in my channel report
Confirm the channel group rule is saved and set as default. Channel group changes can take up to 48 hours to appear in standard reports. Use DebugView to verify the parameters are firing correctly in real time.
window.asvaLayer is undefined in the console
window.asvaLayer is undefined in the console
The snippet is either not loading or loading after a navigation event fires. Confirm it is placed inside
<head>, not before </body>. Check your browser network tab for a request to cdn.asva-ai.com/attribution.js — a 404 or blocked request indicates an incorrect Property ID or a content security policy blocking the script.AI Source is always empty even for known AI referrers
AI Source is always empty even for known AI referrers
Some AI surfaces strip referrer headers inconsistently. Sessions classified through behavioral fingerprinting (rather than a detected referrer) will have
is_ai_session = true but ai_source may be empty. Filter on is_ai_session = true rather than ai_source is not empty to capture all AI Commerce sessions.Related
Surface Hidden AI Traffic with Asva Attribution
Understand why AI traffic is misattributed and how the Asva snippet works.
How Asva's Attribution Model Works
Learn how Asva classifies sessions using signal tiers and confidence scores.