Setting up event snippet for google ads conversion tracking

tfm_webmaster
Excursionist
47 0 3

I am using google ads for my shopify website. For tracking conversions, I need to add tags given by google ads.

Google ads give a global tag and an event snippet for that particular event. For this, we use global file ie theme.liquid to place global site tag.

 

My question is where do we have to place the event snippet. Do we have to place it in the head or do we have to place it in body of the page ?
and how do we add code in the head of the page if it is to be added in the head ?
If we are tracking purchases we just add this event snippet on  checkout page for which settings are given. But here I am tracking events like abandoned cart , page view, link click etc, so we wont reach the checkout page.

 

Replies 3 (3)

ecom3_
Shopify Partner
10 1 3

Hi @tfm_webmaster 

 

Heres how to install the event snippet:

 

  1. In Google Ads, in the Event snippet section, select Page load.
  2. Copy the event snippet code.
  3. In another browser window, open your Shopify admin and click Settings > Checkout.
  4. In the Additional scripts text box, paste the event snippet. If you already have code in the Additional scripts text box, then add the event snippet on a new line below the existing code.
  5. Copy the global site tag used in the Install the global site tag step. Add this tag above the event snippet added in step 4.
  6. 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 once per customer:
    1. On the line before the snippet, paste {% if first_time_accessed %}.
    2. On the line after the snippet, paste {% endif %}.
  7. The default currency is USD. If you don't sell in US dollars, then replace 'USD' in the event snippet with '{{ currency }}'.
  8. The default transaction ID is blank. To prevent Google Ads from recording duplicate conversions, next to 'transaction_id': replace '' with '{{ order_number }}':

 

Regarding tracking multiple different events in different pages in your shop, this video could be useful for you.

Was your question answered? Mark it as an Accepted Solution

ecom3 | We build e-commerce.
Growth consulting, Design & Development
www.ecom3.de
tfm_webmaster
Excursionist
47 0 3

Hi there!

Actually this is not a conversion tag for a purchase, and we wont reach the thank you page that comes after the order is placed. I have to do conversion tracking for page view event of a product page. So, I think I have to add it there on that product page. That's why I am asking if I should place it in head or body.

p1Commerce
Shopify Partner
125 17 64

I've created a tutorial for this purpose: https://www.p1commerce.com/resources/tracking.php

If you're technically savvy you can just take and integrate the event components.

Appreciate the assistance? Please hit the Like and Accepted Solution buttons.
--
An Exceptionally Technical eCommerce Firm
Entirely Focused on Search Position - p1commerce.com