Google Ads conversion tracking
你可以使用谷歌广告转换跟踪track actions that people take on your website after clicking one of your ads. For example, with Google Ads conversion tracking set up, you'll know which one of your Google Ads advertisements generates the most sales on your online store.
Learn more aboutconversion settingsfrom Google Ads Help.
Requirements
Before setting up custom Google conversion tracking through edits to the theme code or through a third-party app, ensure that you don't already have conversion tracking events set up in your Google Ads account. If you're using Shopify'sGoogle & YouTube channel, then the channel automatically adds conversion tracking events to your Google Ads account during setup.
If you set up custom tracking on top of an existing conversion tracking configuration, then your store might have duplicated conversion tracking events. Duplicated conversion tracking can cause inaccurate report data and problems with ad optimization. When you set up custom tracking, you can deactivate duplicated conversion tracking events from your Google Ads account. If you need to deactivate duplicated conversion tracking events from your Google Ads account, then make sure you deactivate only the duplicated tracking events. Deactivating non-duplicate conversion events can decrease ad tracking accuracy and efficiency.
Before following this guide, you need to:
- Have a Google Ads account
- Be running, or planning to run, an ad through Google Ads
Setting up Google Ads conversion tracking
To set up Google Ads conversion tracking, you need tocreate a conversion action,install the Google tag, and thenadd the event snippet. If you’re tracking purchases, then you also need toedit the event snippetto adjust the value of the conversion based on the purchase amount.
Step 1: Create a conversion action in Google Ads
To set up Google Ads conversion tracking, follow theGoogle Ads instructionsfor creating a conversion action.
The most common kind of conversion action is tracking purchases. Tracking purchases helps you understand how effective your ads are at generating sales on your online store To track purchases, set the category toPurchase/Sale, and the value toUse different values for each conversion.
When you’re done creating your conversion action, clickCREATE AND CONTINUE.
Step 2: Install the Google tag
After you create a conversion action, you need to install the Google tag in your Shopify theme code. The steps you need to follow will differ depending on your tag's ID (starting withAW-
orG-
).
Follow the instructions onadding your Google tag manuallyon Google Ads Help.
Step 3: Install the event snippet
After you install the Google tag, you need to add the event snippet to your checkout page. The event snippet tracks a conversion any time somebody clicks one of your ads and then later reaches the checkout page on your online store.
Steps:
- In Google Ads, in theEvent snippetsection, selectPage load.
- Copy the event snippet code.
- In another browser window, open your Shopify admin and clickSettings>Checkout.
- In theAdditional scriptstext box, paste the event snippet. If you already have code in theAdditional scriptstext box, then add the event snippet on a new line below the existing code.
- Copy theGoogle tagused in theInstall the Google tagstep. Add this tag above the event snippet that you added in step 4.
- If a customer reloads the checkout page, then Google Ads might record a duplicate conversion. To prevent duplicate conversions, add tags before and after the event snippet so that it triggers one time per customer:
- On the line before the snippet, paste
{% if first_time_accessed %}
. - On the line after the snippet, paste
{% endif %}
.
- On the line before the snippet, paste
- The default currency is
USD
. If you don't sell in US dollars, then replace'USD'
in the event snippet with'{{ currency }}'
. - The default transaction ID is blank. To prevent Google Ads from recording duplicate conversions, next to 'transaction_id': replace
''
with'{{ order_id }}'
. - ClickSave.
After making these changes, your script should look similar to the following example:
Step 4: Make the conversion value dynamic
If the conversion action you’re tracking is purchases on your online store, then the value of each conversion is different.
For example, Andy owns an apparel store, and is running two different ads through Google Ads: one for his collection of watches, and one for his collection of T-shirts. Although both ads generate a similar number of clicks and sales on his online store, the value of the purchases made by people who click the watch collection advertisement is higher. The value is higher because customers buy more expensive items after they click that ad. Andy uses this information to decide where to spend his advertising dollars.
To track a different value for each conversion, you need to edit your event snippet to use values that are specific to each transaction.
Steps:
- 打开你的Shopify管理并单击Settings>Checkout.
- In theAdditional scriptstext box, find the event snippet that you added inStep 3: Install the event snippet.
- Replace the line beginning with
'value':
with one of the following snippets:- To exclude taxes and shipping from the conversion amount, replace it with this snippet:
'value': {{ checkout.subtotal_price | divided_by: 100.0 }},
- To include taxes and shipping in the conversion amount, replace it with this snippet:
'value': {{ checkout.total_price | divided_by: 100.0 }},
- To exclude taxes and shipping from the conversion amount, replace it with this snippet:
- ClickSave.
After making this change, your script should look similar to the following example:
To make sure your tag is working, check the tracking status on theConversion actionspage in your Google Ads account. It might take a few hours for the conversion tracking tag to display as verified.
设置remarketing
Remarketing helps you target ads to people who visited your store in the past. Dynamic remarketing targets ads to your store's visitors based on the specific products they viewed on your site. You complete most of the setup for remarketing and dynamic remarketing through your Google Ads account. Read Google's setup guides forremarketinganddynamic remarketingto set up the remarketing code on Google.
You need to edit your theme code to add the remarketing code to your Shopify store. This is an unsupported theme customization, but you can try to find help in theShopify Community forums, orhire a Shopify expertto edit your theme's code for you.
For more help using remarketing or dynamic remarketing for your online store, visitGoogle Ads Help.