Facebook Ads API - e-mails and hashes in a Custom Audience

facebook, facebook-ads-api

Solution

The trick was normalizing the emails (in accordance with https://developers.facebook.com/docs/reference/ads-api/custom-audience-targeting#hash) before hashing them.

I'm in Python, so for me that was doing `email_string.lower().strip()` instead of just the email_string. The lower() was more important because I don't think there was any whitespace but there definitely were e-mails with capital letters.

Problem

I upload a csv of 212 emails through Facebook's Power Editor, and after some seconds I can see that 200 users are in the audience. I upload a csv of the sha256 hashes of those same 212 emails through Facebook's Power Editor to a different Custom Audience, and after some seconds I can see that 100 users are in the audience. I use the Ads API to add a list of those same 212 hashed emails to a different Custom Audience, and after some seconds I can see that 100 users are in the audience. It seems to me that uploading raw vs. hashed emails should not change how many are able to be matched in Facebook. Is this behavior expected or unexpected? Why is it happening?

Original source