fbpx
Tools, apps and e-commerce websites
Google Merchant Center

Adding Dynamic Remarketing Tags for Google Ads in Shopify

Dynamic remarketing is a marketing method that reengages with users that have already interacted with your business in some way. Usually, this involves targeting someone who has already seen your Google Ads

The benefit to this is that you can create conversions amongst users who have already started the customer journey.

Getting Started with Dynamic Remarketing

Before you can add dynamic remarketing ads to Shopify, you’ll need to have a Google Merchant Center account and a product feed. You can read up on how to upload your feed here. You’ll also need to link your merchant center and ad accounts.

Step 1 

Login to Google Ads 

Click on the ‘Tools and Settings’ icon  and then select ‘Audience Manager’ 

Click on ‘Set up an Audience Source’  and select ‘Set Up Google Ads Tag’.

You will now create a data source for the Google Ads tag. 

Select ‘Collect data on specific actions’ from the Remarketing section and then check off the most appropriate business type for your business. 

Afterwards, scroll down and select ‘Save and Continue’ to move on.  

Step 2 

Next, choose ‘Install the Tag yourself’  and then ‘Continue’. 

You will see two boxes filled with code in each box. 

We’re  only going to use the second box, also labelled as the Event Snippet.

It’s important to note the audience Source Tag ID for later use. This tag is the 10 digits following AW in the image below. 

Step 3

To continue, you’ll need to log into Shopify. Navigate  to Online Store > Themes. Then click Actions > Edit Code. 

Under Layout, select theme.liquid. This is where we are going to paste code in order to set up the remarketing tag. This is a little tricky, so read the following steps carefully.

Copy the code below into a text editor to be used later. 

THEME.LIQUID

<!– Global site tag (gtag.js) – AdWords: –>

<script async src=”https://www.googletagmanager.com/gtag/js?id=AW-411030843“></script>

<script>

 window.dataLayer = window.dataLayer || [];

 function gtag(){dataLayer.push(arguments);}

 gtag(‘js’, new Date());

gtag(‘config’, ‘AW-411030843’);

</script>

{% if template contains ‘index’ %}

<script>

 gtag(‘event’, ‘page_view’, {

 ‘send_to’: ‘AW-411030843’,

 ‘ecomm_pagetype’: ‘home’

 });

</script>

{% elsif template contains ‘collection’ %}

<script>

 gtag(‘event’, ‘page_view’, {

 ‘send_to’: ‘AW-411030843’,

 ‘ecomm_pagetype’: ‘category’

 });

</script>

{% elsif template contains ‘product’ %}

<script>

 gtag(‘event’, ‘page_view’, {

 ‘send_to’: ‘AW-411030843’,

 ‘ecomm_pagetype’: ‘product’,

 ‘ecomm_prodid’: ‘shopify_US{{ product.id }}{{ product.variants.first.id }}’,

 ‘ecomm_totalvalue’: ‘{{ product.price | money_without_currency | remove: ‘,’ }}’

 });

</script>

{% elsif template contains ‘cart’ %}

<script>

 gtag(‘event’, ‘page_view’, {

 ‘send_to’: ‘AW-411030843’,

 ‘ecomm_pagetype’: ‘cart’,

 ‘ecomm_prodid’: [{% for item in cart.items %}’shopify_US{{ item.product.id }}{{ item.product.variants.first.id }}'{% unless forloop.last %},{% endunless %}{% endfor %}],

 ‘ecomm_totalvalue’: ‘{{cart.total_price | money_without_currency | remove: ‘,’ }}’

 });

</script>

{% elsif template contains ‘search’ %}

<script>

 gtag(‘event’, ‘page_view’, {

 ‘send_to’: ‘AW-411030843’,

 ‘ecomm_pagetype’: ‘searchresults’

 });

</script>

{% else %}

<script>

 gtag(‘event’, ‘page_view’, {

 ‘send_to’: ‘AW-411030843’,

 ‘ecomm_pagetype’: ‘other’

 });

</script>

{% endif %}

Checkout Section

{% if first_time_accessed %}

<script async src=”https://www.googletagmanager.com/gtag/js?id=AW-411030843“></script>

<script>

window.dataLayer = window.dataLayer || [];

function gtag(){dataLayer.push(arguments);}

gtag(‘js’, new Date());

gtag(‘config’, ‘AW-411030843’);

</script>

<script>

gtag(‘event’, ‘page_view’, {

‘send_to’: ‘AW-411030843’,

‘ecomm_pagetype’: ‘purchase’,

‘ecomm_prodid’: [{% for item in checkout.line_items %}’shopify_US_{{item.product.id}}_{{ item.variant.id }}’,{% endfor %}],

‘ecomm_totalvalue’: {{ checkout.total_price | money_without_currency | remove:’,’ }}

});

</script>

{% endif %}

The first part of the code is the only part we will need to make changes to, specifically in the specified sections:

You will need your Google Adwords ID that occurs repeatedly in the above example as AW-411030843.

  • Now, copy the code into a text editor and replace this value to your audience tag id (this is the 10-digit number from earlier) in all the sections that are bolded above.
  • By default the code is set up for the US. If you want to target a different country, you will need to change the value of fa_product_id_alpha2_code to match your target country’s code. For example, the code for Australia is AU. 

Check out the full list of country codes below: https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/enum/countrycode

  • If you’re in the US, you must keep fa_prices_with_decimal_separator to true. If you are in a European country, then change this setting to false.
  • Next, you will double check the product id by going to Google Merchant Center > Products > List. Here, you will see what kind ofID you are using. 
    • If it looks like shopify_US_81191654332_1055121650148, then keep fa_product_id set to default.
    • If it looks like 1055121650148 then set the value fa_product_id to product_id.
    • If it looks like the main id 81191654332 then set the value fa_product_id to parent_id.
    • If it looks like a sku then set the value fa_product_id to sku.

Step 4 

Now, paste your updated code from earlier between the <head> and </head> tags in theme.liquid in the Shopify ‘theme editor’ page from before. 

Once you’ve made the changes in the code in theme.liquid, click Save

Next, you will need to go to your Shopify Settings and then Checkout.  

Find ‘Order Processing’, and then navigate to the Additional Scripts textbox. This is where you will paste your updated code for the second time. Remember to click save! 

After you’ve done this, your remarketing tag has been successfully set up and you can begin setting up your dynamic remarketing campaign!

Creating Audience Lists with Dynamic Remarketing

After a couple of days have passed, you will be able to create lists of your website visitor audience using the code that you just used during this process.

To create an audience list, Log in to Google Ads. Select the Tools and Settings icon like before, then select Audience Manager.  

Click on the blue plus bubble and then select ‘Website visitors’. 

Go to the visited page section and select ‘event’ from the drop down list.  Change the operator to equals and the value (in this example) view_item_list and click on Create Audience.

Here is a list of event values you can use within your audience list: 

  • view_item_list
  • view_item
  • view_search_results
  • add_to_cart
  • index
  • purchase
  • other

Additionally, you can choose a rule for the following groups

  • event
  • google_business_vertical
  • id
  • value

If you ever need more help setting up your online store or setting up dynamic remarketing, don’t hesitate to contact ShoppingFeeder for all of your store setup needs. 

Insights Weekly Get weekly updates, tips and valuable insights on everything e-commerce.
error

Enjoy this blog? Spread the word