Last modified January 14, 2021 by Shelly Wolfe

Export Facebook Custom Audiences

The Swrve dashboard provides powerful, actionable insights into your users’ behavior and enables you to use this data to engage and re-engage the user. It is also useful to use Swrve data to re-engage users outside the Swrve platform or find corresponding audiences using tools like Facebook’s Custom Audiences. The Swrve User DB data enables you to do this. This article describes how to use the Swrve user DB data for Facebook Custom Audience creation.


This guide presents an area of advanced analysis, so ensure you have completed the following:

  • Fully instrumented Swrve into your app.
  • Downloaded the Swrve user DB and loaded it into a database to allow querying. For a tutorial on how to automate this loading process, see Automating user DB imports.
  • You are sending a mobile advertising ID such as IDFA, Android Advertising ID or Facebook App User ID to Swrve.
For the purpose of this tutorial, the advertising identifier is sent to Swrve as a custom user property called advertising_id. In your Swrve instrumentation, you may be sending more than one advertising ID and may have names like idfa, android_advertising_id, facebook_id, and so forth for these identifiers.

Swrve segments

To start, let’s look at a sample Swrve segment.

Repeat purchasers segment

Trend Reports show important details about your segments.

Exporting lists of users and advertising IDs by segment

A good first step to take with Swrve user DB data is to attempt to replicate the data in a Swrve Trend Report with an SQL query. Since the Swrve dashboard updates multiple times a day and the user DB exports update at different times during the day, there may be discrepancies between the two reports. It’s good to understand this as a baseline so you know if further analyses need to take the discrepancy into account.

For example, to see how many users fall into the segment you’re interested in, use the following query:


SELECT COUNT(1) AS user_count,
FROM segment_membership
WHERE repeat_purchasers = 1

From here, you can start to export facts you’re interested in about your users. For example, the user’s advertising_id.


SELECT advertising_id
FROM segment_membership
INNER JOIN custom_properties
  ON segment_membership.swrve_data_id = custom_properties.swrve_data_id
WHERE repeat_purchasers = 1

Example result

Screen Shot 2015-11-05 at 4.39.25 PM

Upload Custom Audience data to Facebook

To create a Facebook Custom Audience, you need more than 20 users in your segment.

With the data from your SQL query, you now have a CSV file to upload to Facebook to create your Custom Audience.

Screen Shot 2015-11-06 at 11.15.06 AM

Need a hosted solution?
Most Swrve customers can self-host this pipeline; all you have to do is follow the steps in these tutorials. However, if you prefer a turn-key hosted solution, we do offer one as a professional service. There is an additional fee associated with this service. For more information, contact your CSM at
Need help with Queries?
Swrve support can help you with basic setup and configuration of the pipeline described above. If you need help with your queries, contact our Data Services team at They will help you get the most out of your data with dedicated support, pre-built and custom reports, and dedicated data science hours.