0

We'd like to create a custom audience, based on website pixel data. This should be prefilled with past visitors that match the criteria

Here's an example which does this, but does not prefil

$set = new CustomAudience(null, $account_id);
$set->setData(array(
CustomAudienceFields::ID,
CustomAudienceFields::NAME =>"Test audience",
CustomAudienceFields::DESCRIPTION =>"Test audience from API",
  CustomAudienceFields::SUBTYPE =>'WEBSITE',
 CustomAudienceFields::RULE => '{ 
  "event": {
    "i_contains": "ViewEvent" 
  }
}',
CustomAudienceFields::RETENTION_DAYS =>90


));

$set->create();

What needs to be passed through to trigger the prefil? The docs specify a 'prefil' parameter for curl calls but I cant see the relevant field in the PHP SDK?

Ben
  • 155
  • 2
  • 12

1 Answers1

0

This was missing from the SDK until last night when we patched to add this feature.

You can now just add the parameter: CustomAudienceFields::PREFILL => true and everything should work!

$set->setData(array(
  CustomAudienceFields::ID,
  CustomAudienceFields::NAME =>"Test audience",
  CustomAudienceFields::DESCRIPTION =>"Test audience from API",
  CustomAudienceFields::SUBTYPE =>'WEBSITE',
  CustomAudienceFields::RULE => '{ 
    "event": {
      "i_contains": "ViewEvent" 
     }
  }',
  CustomAudienceFields::RETENTION_DAYS =>90,
  CustomAudienceFields::PREFILL => true,
));
Paul Bain
  • 4,364
  • 1
  • 16
  • 30