Hi! I am trying to create custom audience, but have
UserListError.CONCRETE_TYPE_REQUIRE
Error.
Here is my code on PHP (used example from
https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201806/Remarketing/AddRuleBasedUserLists.php
):
public function addCustomIntentList(array $data)
{
$expressionUserList = new ExpressionRuleUserList();
$expressionUserList->setName('Test item');
$expressionUserList->setDescription(
'Test description'
);
$expressionUserList->setPrepopulationStatus(
RuleBasedUserListPrepopulationStatus::REQUESTED
);
$expressionUserList->setRule(self::createUserListRule($data));
$operation = new \Google\AdsApi\AdWords\v201710\rm\UserListOperation();
$operation->setOperand($expressionUserList);
$operation->setOperator(\Google\AdsApi\AdWords\v201710\cm\Operator::ADD);
return $this->mutateOperations([$operation])[0];
}
/**
* Create a user list rule composed of two rule item groups.
* @param array $data
*
* @return Rule the created rule
*/
private static function createUserListRule(array $data)
{
$ruleItems = [];
foreach ($data as $ruleItem) {
$stringRuleItem = new StringRuleItem();
$stringKey = new StringKey();
$stringKey->setName($ruleItem);
$stringRuleItem->setKey($stringKey);
$stringRuleItem->setOp(StringRuleItemStringOperator::EQUALS);
$stringRuleItem->setValue($ruleItem);
$newRuleItem = new RuleItem();
$newRuleItem->setStringRuleItem($stringRuleItem);
$ruleItems[] = $newRuleItem;
}
$multipleItemGroup = new RuleItemGroup();
$multipleItemGroup->setItems(
$ruleItems
);
$rule = new Rule();
$rule->setGroups(
[$multipleItemGroup]
);
$rule->setRuleType(UserListRuleTypeEnumsEnum::DNF);
return $rule;
}
addCustomIntentList(array $data - array of strings(domains), which I need to
save via API programmatically like keywords in UI version:
<https://lh3.googleusercontent.com/-XqURSwAxIgE/Wyu98e23PFI/AAAAAAAAAAM/OjagxPQgg7Mb2FdGR0KJB2W1kpN-lk2dACLcBGAs/s1600/Screen%2BShot%2B2018-06-21%2Bat%2B18.01.39.png>
Thank you for help!
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/e05ea74d-9952-4037-88ab-82371d8d1f7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.