How to Build a Custom Audience with PDL
July 15, 2022
Table Of Contents
Before You Start
Goal: Build a Custom Audience list using Python and the PDL Company Enrichment & Person Search APIs.
Level: Advanced – You know how to make API calls in Python and parse the response.
What You'll Need:
To run the code samples in this tutorial, install, , and
Credit Usage: If you run the code as-is in this tutorial, it will use:
25 Company Enrichment Credits
50 Person Search Credits
In this tutorial, we will walk through how to use PDL’sand APIs to build a Custom Audience of decision makers at Software as a Service (SaaS) companies based in New York City.
What is a Custom Audience?
In marketing campaigns, it can be helpful to create Custom Audiences - lists of people who share certain characteristics that mean they may be interested in your product. Custom Audiences are frequently used in social media marketing campaigns (ex:and ), since they can send tailored material directly to the people most likely to buy your product or service.
Step 1: Enrich Company Data from Initial List
Let’s assume that we were given aof potential NYC-based tech companies to build our Custom Audience from. However, all we have to go off of is very basic information for each company.
Since our Custom Audience requirements are more specific than the information we were given, this is an excellent opportunity to use.
Let’s pull PDL’s records for each company using the following code:
Call the function like this:
Once you run the code, you should see:
Step 2: Filter Company List using Criteria
The Company Enrichment API response contains a lot of information about each company in a standardized format. For more information on all the data in the Company Enrichment API response, see .
From our, we know companies in our Custom Audience should be:
Based in New York City
In the Software as a Service (SaaS) industry
Since our initial list already provided only NYC-based companies, we can skip filtering for that and just determine which companies work in SaaS.
PDL'sfield is a great way to find a company’s major associations, so let’s use it.
Call the function on the enriched DataFrame:
Now we've filtered our initial list down to three NYC SaaS companies.
Step 3: Find Decision Makers at Each Company
Now that we have our list, we want to find decision makers at the companies to advertise to. In this tutorial we define “decision makers” as all employees whoseis Director, VP, Partner, Owner, or “CXO” (CEO, CFO, CTO, etc.).
Let’s useto search each company for all employees that match our criteria. Each employee should:
Work for one of our targeted companies
Be a decision maker
Have a known work email (so our marketing material can reach them)
The Person Search API supports queries written in SQL or Elasticsearch. PDL strongly recommends using Elasticsearch, since it is what our architecture is based on and supports more detailed queries.
For more information on writing queries using Elasticsearch, see https://blog.peopledatalabs.com/post/query-builder-tutorial.
In Elasticsearch, the query for our custom audience looks like this:
We can send the request to the Person Search API like this:
⚠️ Warning: High API Credit Usage ⚠️
This code snippet finds 50 profiles, costing 50 Person Search credits. If your plan’s rate limit is less than that, you can change the
size parameter in the request to limit the number of responses or contact firstname.lastname@example.org to increase your limit.
Call the function like this:
Which gives us 50 PDL profiles of decision makers at our target companies as a pandas DataFrame:
We’ve found our Custom Audience!
Step 4: Export the Custom Audience List
Depending on the marketing tool we want to use, we will export our Custom Audience DataFrame according to the tool's requirements.
For example,supports a that we can build by exporting the DataFrame like this:
Similarly, if we wanted to use, we can build a CSV according to like so:
What We’ve Accomplished
In this tutorial, we took a basic list of potential target companies and used it to build a highly targeted Custom Audience that we can use for an advertising campaign.
We walked through how to:
Run a starting list of companies through the PDL Company Enrichment API to get more information about them
Filter the dataset to target just the companies tagged “SaaS”
Use the PDL Person Search API to find decision makers working at each target company
Turn the person matches into Custom Audience CSVs that can be uploaded to Twitter and Facebook
See the full code for this tutorial here:
For More Information:
Questions? Reach out to , we’ll be happy to help!
Noticed any issues with this tutorial? Let us know at !