How to Add Tracking Template to Google Shopping Ads?
I think Google Analytics & Shopify aren’t properly attributing sales from Google shopping Ads, I even clicked an Ad and looked at tracking in browser & saw the word “organic” in the tracking tags.
How can I 100% make sure my Google Shopping Ads get credit for sales from these Ads?
The short answer is:
Your attribution issue, where Google Analytics 4 (GA4) or Shopify reports ‘organic’ traffic for Google Shopping Ads, stems from client-side tracking limitations like ad blockers or delayed landing page loads causing the Google Click ID (gclid
) to be lost before the tag fires.
The 100% fix is to implement server-side tracking using Google Tag Manager (GTM) Server-Side and Stape to act as a proxy, in conjunction with the Google Analytics Measurement Protocol for purchase events and the Google Ads API for Enhanced Conversions.
This server-side architecture ensures the gclid
is captured on the server as soon as the click happens, synced with the purchase event from Shopify via the Shopify API/webhooks (specifically the orders/create webhook), and then sent to Google Ads using the Google Ads API.
You must also ensure Google Ads auto-tagging is enabled and, crucially, set a Tracking Template in your Google Shopping Campaign or Ad Group (e.g., &campaignid={campaignid}&adgroupid={adgroupid}&creative={creative}&placement={placement})
to force all clicks to carry the necessary ValueTrack parameters for GTM Server-Side to capture, thereby guaranteeing credit for your paid traffic.
The long answer is:
The observation of “organic” in your tracking tags or seeing misattributed sales in Google Analytics 4 is a classic symptom of client-side tracking degradation on the Shopify platform, particularly common with Google Shopping Ads where ad-blockers, network latency, or browser restrictions prevent the Google Tag from reading the critical gclid
parameter from the URL before navigation or tag execution occurs, resulting in the session falling back to the default channel grouping, often Organic Search if a previous search was involved.
The most robust and cost-effective solution is a server-side tracking integration utilizing a three-part API synchronization process.
First, you must correct the initial click tracking by ensuring Google Ads auto-tagging is active in your Google Ads account, which automatically appends the gclid
to your final URLs.
Then, you need to add a Tracking Template at the campaign level (or product group level for granular control) in Google Ads, containing key ValueTrack parameters like {lpurl}?
.utm_source
=google&utm_medium
=cpc&campaignid={campaignid}&adgroupid={adgroupid}
This is vital as it forces the click to contain these parameters, making them easier for your server-side environment to capture and link to the session upon landing.
Second, you set up a GTM Server-Side container hosted on Stape, which functions as a privacy-enhancing, first-party tracking domain proxy.
When a user clicks your Shopping Ad, the landing page uses a custom loader to send the initial page view event to your Stape server, capturing the URL parameters (including the gclid
) before the browser can strip them or a blocker interferes.
This initial server event establishes a reliable Client ID and stores the critical gclid
value.
Third, you use the Shopify API/webhooks to reliably capture the confirmed purchase data on the backend.
Specifically, the orders/create webhook is configured to trigger a POST request to your Stape server-side GTM endpoint the moment a purchase is finalized in Shopify, bypassing the browser entirely.
This webhook payload contains the revenue, product details, customer ID (hashed for privacy), and the stored Client ID.
Finally, within the GTM Server-Side environment, you use the Google Ads API to implement Enhanced Conversions for Web.
The purchase data received from the Shopify webhook, combined with the gclid
from the initial click event (which the server can now link back to the user via the Client ID), is formatted and sent to the Google Ads API’s ConversionUploadService.
This process sends the conversion directly from your server to Google Ads, with a privacy-safe, hashed version of the customer’s first-party data (like email or phone number) to significantly improve the match rate with signed-in Google users.
This server-to-server data exchange eliminates the risk of browser-based data loss, guaranteeing that all valid sales are accurately attributed to the original Shopping Ad click via the gclid
, providing 100% reliable conversion credit and allowing Google Ads to optimize your bidding strategies effectively.
This integration is highly cost-effective because it minimizes ad spend wasted on misattributed or untracked conversions and leverages the Google Ads API, which is typically free to use for this purpose, with the only cost being the Stape hosting for the server-side GTM.
Additionally, integrating the BigQuery API can be an excellent next step to stream your raw, server-side GA4 data into a warehouse for advanced, custom attribution modeling in Looker Studio, combining the reliable gclid
from the server with the granular user journey data for a comprehensive view of marketing performance.