skip to Main Content

I created a Custom Audience of type “Customer List: Value-based”.

I then used that to create a “value-based Lookalike Audience”.

The documentation for “value-based Lookalike Audience” is here.

But what I want to know is:

How can I use the PHP SDK to update my Custom Audience of type “Customer List: Value-based” via the API?

(Then, the changes will flow through to the lookalike audience, which is what I use in my ads targeting.)

I cannot find documentation.

P.S. Ding Zhang of Facebook encouraged me to ask the question here since none of the people I reached at FB were willing to answer my question directly. Any awesome FB developers out there? You get major points for being able to answer this one!

2

Answers


  1. Chosen as BEST ANSWER

    I finally found some documentation here.

    use FacebookAdsObjectCustomAudienceMultiKey;
    use FacebookAdsObjectCustomAudienceNormalizersHashNormalizer;
    use FacebookAdsObjectFieldsCustomAudienceMultikeySchemaFields;
    
    $users = array(
      array('[email protected]', 44.5),
      array('[email protected]', 140),
      array('[email protected]', 0),
      array('[email protected]', 0.9),
    );
    
    foreach ($users as &$user) {
      $user[0] = hash(HashNormalizer::HASH_TYPE_SHA256, $user[0]);
    }
    
    $schema = array(
      CustomAudienceMultikeySchemaFields::EMAIL,
      'LOOKALIKE_VALUE',
    );
    
    $audience = new CustomAudienceMultiKey('<CUSTOM_AUDIENCE_ID>');
    $audience->addUsers($users, $schema, true);
    

    I'm excited to try this out.

    P.S. I still can't find the "magic string" of 'LOOKALIKE_VALUE' referenced or defined anywhere in the SDK.

    This blog post was how I first found this documentation after hours of Google searches.


  2. P.S. I still can’t find the "magic string" of ‘LOOKALIKE_VALUE’ referenced or defined anywhere in the SDK.

    FacebookAdsObjectFieldsCustomAudienceMultikeySchemaFields::LOOKALIKE_VALUE
    

    In "facebook/php-business-sdk": "^6.0.0"

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search