How To Turbocharge Your Shopify Store With Facebook’s Dynamic Product Ads (1/2)


If you’re a Shopify marketer or entrepreneur and want to learn how to turbocharge your Facebook advertising, then you’re in the right place.

Facebook is one of the top performing acquisition channels for Shopify stores with an average conversion rate of 2.49%.

Despite this fact, many marketers fail to create a positive ROI for their Facebook campaigns because of one main reason.


Advertisers try to sell to shoppers too early, on their first encounter with the brand or when they are still in the comparison shopping stage and not yet ready to buy.

This means lost dollars and poor return on investment.

Facebook dynamic products ads allows you to target shoppers with ads based on their on-site behaviors, show to shoppers when they are most likely to buy, when their purchase intent is peaked.

As you’ll learn in this series, following this Facebook advertising strategy resulted in 16900.45 AUD revenue with 660.20 AUD ad spend which meant a 2,459.90% ROI improvement for one of our clients, ByCharlotte.

In the first part of this two part blog series we will teach you how you too can follow this strategy and how to practically set up Facebook dynamic product ads for your Shopify store.

In part two we’ll share our learnings and results from a ByCharlotte Facebook ads campaign.

Finally we’ll be hosting a live webinar where we dig deeper into Facebook advertising strategies, offering live Q&A and live feedback on your campaigns.

Sign Up To The Shopify Facebook Ads Newsletter:

Get notified when we publish part 2 in the series.
Get invitations to our next LIVE Shopify Facebook Ads Webinar.

Here’s what we’ll cover in part 1:


  • Creating your Facebook ads strategy
  • Leveraging retargeting for Facebook ads success
  • Basic Facebook business set up
  • Facebook pixel installation for Shopify
  • Setting up DPA tracking and event triggers
  • Creating your product catalog
  • Creating your DPA campaign in Facebook

In part 2 we’ll draw back the curtain on ByCharlotte, a jewellery brand on Shopify based out of Sydney and how they achieved a 2,459.90% ROI using our exact strategy and set up.

1. Creating Your Facebook Ads Strategy

When it comes to Facebook advertising just like with any marketing efforts, you need a strategy.

Without one you’ll simply be throwing stuff against the wall and hoping something sticks.

With a strategy you can make sure you’re aligned with your team, so you work together and progress faster.

For setting up your strategy you need a clear business objective.

Every business objective is made up of a goal, objective, KPI and target.

The most important KPI to determine the success of your Facebook campaigns is your conversion rate of shopper to buyer.

The following screenshot of a Compass Benchmark Report shows how a Shopify store is comparing vs. a peer group of similar stores.

shopify facebook dynamic product ads

The store has a conversion rate of only 0.4% while the best 25% similar stores (green line) achieve a conversion rate of 3.69% on average.

That’s a lot of money being left on the table.

If you want to evaluate your performance before you start working on a new campaign, you can set up a free Compass account to benchmark your Facebook Conversion Rate (and other metrics). This allows you to set a realistic goal for your campaign based on your peer group’s results.

Facebook dynamic product ads more often than not will sky rocket your Facebook ads conversion rates.

They’re the foundation to building the most profitable Facebook advertising funnels for your Shopify store and increasing your Facebook conversion rates.

Let’s get started with the campaign setup.

Benchmark Your Facebook Conversion Rate

How does the conversion rate of your store compare with the best in YOUR market?

Get your store’s free Acquisition report »

2. Leveraging Retargeting For Facebook Ads Success

As we mentioned earlier, timing is hugely important when it comes to creating your Facebook strategy. Therefore the key to successful Facebook advertising is understanding what types of campaigns to create for different parts of your customer journey.



A common mistake you see again and again with Facebook ads strategies is trying to sell to people too early in the customer journey and sales funnel.

Hence the low conversion rates.

The best way to get high conversion rates and cheap sales from Facebook advertising is through our two step sales funnel.

  1. You drive cheap traffic to your website content and Shopify collection pages using user acquisition campaigns
  2. You retarget that traffic segmented by specific user behaviors using Dynamic Product Ads

The first step in this sales funnel is all about brand awareness. You want to get as many eyeballs on your ads and content as possible and optimize for cheap click to your website.

This allows you to build what are known as ‘custom audiences’.

These custom audiences are simply a lead lists of people who have clicked on your ads and visited your site, where you’ve then started to track them (by placing a cookie on them) and put them in a specific segment or bucket based on their actions for later retargeting.

Let’s now learn how to setup your Shopify store and Facebook for DPA ads and then we can dive into the details.

3. How To Create An Ad Account On Facebook

First things first, you’ll need to cover the basics. To run Facebook ads for your Shopify store you will need:

  1. A Facebook Page to associate to your Shopify store and brand
  2. A Facebook Business Manager Account
  3. A Facebook Ad account with your credit card connected
  4. Create a Facebook pixel

To create a Facebook page go here: and follow the instructions.

To set up a Facebook business account go here: and follow the instructions.

To create a Facebook ad account go here: and follow the instructions.

To create a Facebook pixel go here: and follow the instructions.

4. Shopify Facebook Pixel Integration & Installation

Once you’re set up on Facebook Business you’ll need to install the Facebook pixel in Shopify so your can track and cookie visitors, allowing you to later retarget them with dynamic product ad campaigns.

shopify facebook ads pixel integration

Click on Online Store > Preferences and scroll down to Facebook Pixel.

You’ll need to grab your Facebook Pixel ID from here:

Look in the top right hand corner for Pixel ID.

Then paste it into the form field.

To learn more about integrating your pixel with Shopify go here:

NB: Make sure you delete any manually integrated pixels in your theme if you are going to use the Shopify pixel loader. As duplicate pixels will cause tracking irregularities.

Old pixels are normally found in the theme.liquid file just below the </head> tag.

You can also install the FB Pixel Helper Chrome extension to check what pixels you have installed.

How To Manually Install The Facebook Pixel

If you want to manually install the Facebook pixel in your theme you need to go here and grab your pixel:

Click Actions and then View Pixel.

The pixel code should look like this:

<!-- Facebook Pixel Code -->
fbq('init', YOUR_FACEBOOK_ID); // Insert your pixel ID here.
fbq('track', 'PageView');
<noscript><img height="1" width="1" style="display:none"
<!-- DO NOT MODIFY -->
<!-- End Facebook Pixel Code -->

shopify facebook dynamic product ads

Then navigate to the Edit HTML/CSS section of your theme as above.

Click on theme.liquid and paste the code above the closing </head> tag.

shopify facebook dynamic product ads

5. Setup DPA Tracking & Event Triggers

As discussed earlier in the post we want to show specific ads to specific segments of website visitors dependent on the actions they take on the site.

The three actions we will track and optimize DPA campaigns around are:

  1. ViewContent
  2. AddToCart
  3. Purchase

Let’s start with steps 1 and 2.

Add ViewContent & AddToCart snippets to product.liquid

This code should be pasted into your product.liquid file

fbq('track', 'ViewContent', {
content_ids: ['shopify_{{ }}_{{ }}'],
content_type: 'product'
// Insert Your Add-To-Cart Button's ID below.
$('#ADD_TO_CART_BUTTON_ID').bind( 'click', function(){
// Change the line below to whatever is needed to extract the selected variants
// ID, e.g.: var variant_id = $("form").first().serializeArray()[0]["value"];
var variant_id = YOUR_CODE_HERE;
fbq('track', 'AddToCart', {
content_ids: ['shopify_{{ }}_' + variant_id],
content_type: 'product'

There are 2 points here worthy of note:

1. ID Format

In line 4 we create a unique ID for the product variant being viewed by the visitor and put it into the content_id variable. This ID must have the following format: shopify_<PRODUCTID>_<VARIANTID>, e.g. shopify_284197941_670889949.

It is important that you use this exact format because it is used by the App that we’ll later use sync our store’s products with Facebook.

2. Customize line 9 and 13 to add the AddToCart event

This bit is harder.

There is no one way to complete this task in all themes.

You will have to look at your own themes source code to find some specific details.

2.1 Find a selector for your buy button:

The code snippet above uses jQuery to fire a javascript function whenever a visitor clicks the “Add to cart” button on your product page.

You’ll need to change #ADD_TO_CART_BUTTON_ID on line 9 in the snippet to a valid jQuery selector that identifies the button on your page.

This is easy to find, just look at your product page, right click on the add to cart button in the Google Chrome browser and click inspect.

shopify facebook dynamic product ads

You can then find the ID in the inspect window when you look at the button code that should be pre highlighted.

2.2 Provide the Id of the product variant that is being added to the cart:

There are a ton of ways the “add to cart” can be coded in a theme.

Some themes submit a form, in this case you’ll want to extract the variant ID from that form.

(It might be a good idea then to include a slight (< 200ms) delay before the form is submitted and a new page loaded so that the tracking calls can reach facebook’s server before then.)

Some shopify themes use Ajax (e.g. with Shopify’s Ajax API) for the “add to cart” button. In that case you’ll have to hook into the existing javascript callback for that button.

3. Add Purchase Event Code

For this next part we need to paste the code into the Shopify admin.

First navigate here:

Shopify admin > Settings > Checkout > Order processing

shopify facebook dynamic product ads

Then paste in the following script.

{% if first_time_accessed %}
// Insert Your Facebook Pixel ID below.
fbq('init', 'FB_PIXEL_ID');
fbq('track', 'Purchase', {
content_ids: [{% for item in order.line_items %}'shopify_{{ }}_{{ }}',{% endfor %}],
content_type: 'product',
value:'{{ order.subtotal_price | money_without_currency }}',
{% endif %}

That wraps up the technical setup of your triggers.

6. Setting Up Your Shopify Facebook Ads Catalog

To create a product catalog in Facebook business manager you’ll need a product feed.

The easiest way to create a feed for your store is to use the Product Feed App from Flexify.

Just install the app from the Shopify app store and follow the instructions.

In the app you’ll find your feed url.

shopify facebook dynamic product ads

If you are using the Shopify admin to trigger the Facebook pixel make sure you check the Format feed for the native shopify pixel setting option in Flexify.

shopify facebook dynamic product ads

Once you have your feed set up go here: and follow the instructions on how to set up a product catalog.

However at the point of the guide they say upload your feed, paste in the Flexify URL instead as seen below.

shopify facebook dynamic product ads

7. Shopify Facebook Ads Tutorial: Create Your DPA Campaigns In Facebook

Finally we’re ready to set up out DPA campaign.

The first step is to jump into Facebook ads manager and click create ad.

Then choose Product catalog sales.

shopify facebook dynamic product ads

Make sure you choose the Flexify feed in the product catalog option and name your campaign according to best practice naming conventions.

Next you can will see the audience options you have for retargeting.

shopify facebook dynamic product ads

You can see highlighted here you can select the products to include and also the different segmenting options we discussed.

shopify facebook dynamic product ads

Best practice is to use the Custom combination section and include viewed or added to cart product whilst excluding purchased segments.

Make sure you set all other fields on this page, make sure to consider testing placement of ads as mobile vs desktop as one example can massively change the results you get from a campaign.

Next on the the ad format screen you can pull in fields of data from your product catalog feed.

This will allow you to write a generic description for example, and then customize it per ad variation based on details from specific products or collections.

shopify facebook dynamic product ads


Finally make sure you check Track all conversion from my Facebook pixel that way you can continue to update your purchased visitor segment. We also recommend you to add Google UTM tracking parameter to your add.

Shopify Facebook Ads Case Study

Now that you have a basic understanding of how dynamic product ads work and how to set them up using Facebook business manager and Flexify you’re one step closer to improving your Facebook ads profits and conversion rate benchmark!

In the next post in this series we’ll dig into the granular details of DPAs and answer all those questions that arose from this post.

We’ll cover how to set up great ad creatives, what to target and test and how to optimize your ads.

Drawing back the curtain on a real life case study where another Shopify store ByCharlotte achieved a 2,459.90% ROI improvement when moving to our Facebook DPA strategy.

Sign Up To The Shopify Facebook Ads Newsletter:

Get notified when we publish part 2 in the series.
Get invitations to our next LIVE Shopify Facebook Ads Webinar.