Get the newsletter · 2018 essays (PDF) · Featured · Recent

A clever way to buy Facebook ads based on what your users like (Guest post)

My friend Gagan Biyani wrote up a great piece how to analyze what your Facebook audience is interested in, and using that to buy ads. He’s generously shared it, below. Gagan is CEO and co-founder at Sprig, and before that was at Lyft and started up Udemy. You can follow him on Twitter at @gaganbiyani and he has a new Medium account here. -Andrew

Gagan Biyani, Sprig:
Building Target Groups for Facebook Ads

Facebook advertising is tricky and there are multiple facets to it. By far the most important value of Facebook is being able to target based on demographic information. In this post, I’ll show you exactly how to use the “affinity ratio” to figure out what Facebook likes to target and dramatically increase the performance of your Facebook advertising.

As mentioned above, you have to have Facebook Connect on your app and you must grab the likes of your users. A sample of your users is OK so even if Facebook Connect is merely one option amongst many, that’s fine.

(Credit: This method was created by my co-founder at UdemyEren Bali. We tested dozens of other forms of targeting and nothing came close. I’m sure there are many other companies that have come up with this on their own.)

Note: this only works if you have Facebook like data from your user base

Step 1: Figure out what Facebook pages your users like

Here’s the trick: Download a CSV of all of the unique facebook pages your users like and the COUNT() of the number of users who like each page. Example:


You’ll notice these numbers don’t make a whole lot of sense. That’s because I made them all up!

Notice a few things. First, this list is sorted by greatest # of likes. That list is already a bit useful — and probably something you’ve looked at before. The problem is it doesn’t make this data useful enough.Everyone and their mom’s likes Michelle Obama, so you can’t target your advertising that way. From here, you have to figure out which one of these pages is actually useful to you.

Second, if you have any reasonable-sized user base, you’ll probably have 1000’s of results on the left column. That’s fine but we’ll use a small list for this example. You may have to have some sort of COUNT() limit to make this easier (aka only pages with over 1,000 likes make the cut).

Step 2: Add in the “Global Likes” of those Facebook Pages

Now you need to figure out how many globlal likes each of the pages on your list has. Use the Facebook API or do it manually if you don’t have access to dev resources.

In our B.S. data set above, I went ahead and did it manually. Here’s the data:


In case you’re wondering, I came up with this list by checking Facebook’s page recommendations. They were right on some things (who doesn’t like a little Dr. Oz in the mornings?) and wrong on others (phh, I don’t care about animals).It is probably starting to make sense now. Its not just about the total count of your users who like a given page, its actually about the relativecount.

Step 3: Create a ratio of [Count(users)]/[Global Likes]

From here, your goal is to create an “affinity score” (name created by Dinesh Thiru, who runs marketing at Udemy)


To make these numbers easier to read, I multipled the affinity score by 10,000. Depending on the number of users you have in Column Count(users), you may multiply by a smaller factor of 10.

Now, you have a relative score that allows you to compare different pages. I sorted this list by affinity score. Its interesting to see pages like “Michelle Obama” and “Food Network” to go from the top to the near-bottom of our list! Of course this is make-believe data, but when you have real data you’ll see similar results.

Step 4: Group your high affinity pages

Once you have a list of affinity scores, you need to group them into categories. This is important because otherwise, you wouldn’t have good Facebook targeting groups. Targeting users who like BothSidesoftheTable and the Golden State Warriors will make it hard to write ad copy and create cohesive campaigns.

1-AbAqc1TX5RrSKeZco-5WsgNatural groups will form when you start looking at your data.Two things matter when you are in the final stages of this:

  1. Sample size. The larger the size of your group, the more people you can target with your ads. You don’t want too large a size, though, because then you are paying crazy CPM’s and competing with a larger breadth of advertisers.
  2. Grouping. This is based entirely on your judgement. The natural groups are always ones where you think there’s a lot of overlap amongst those users. Its fairly obvious that people who like TechCrunch and BothSidesoftheTable overlap. In situations like the Monterey Bay Aquarium and In Defense of Animals group, its just a judgement call. Go with your gut.
  3. Expand your targeting using groups. As you create groups, it will be easy to start finding more users to target. So if you have tech blogs like TechCrunch on your list, you can add other ones such as PandoDaily, BusinessInsider and even CNet. Be careful though: there may be a reason your users don’t already like those pages. At Lyft and Udemy, we would use separate ad campaigns for “related” groups and monitor performance accordingly.

That’s a wrap folks. If you have questions, please feel free to ask and I’ll try to get to them.

P.S. This is why we started the Growth Hackers Conference and why I regularly read blogs like Andrew Chen’s or Sean Ellis’s. If you like this, I’ll also try to blog more to help share this kind of information. Tips like this used to be locked up in people’s heads — so poor entrepreneurs like me could never learn them. Now, you can pay $300 (with coupon code “FBadv”) and save months of time and thousands of dollars by going to conferences and reading blog posts about growth hacking. You might also find your next opportunity, meet a great candidate or connect with an industry insider who mentors you.

PS. Get new updates/analysis on tech and startups

I write a high-quality, weekly newsletter covering what's happening in Silicon Valley, focused on startups, marketing, and mobile.