Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#2654) Unsupported operator: The operator operator is not supported #440

Closed
elygiux opened this issue May 4, 2018 · 11 comments
Closed

Comments

@elygiux
Copy link

elygiux commented May 4, 2018

I am trying to create a custom audience by the example in "https://developers.facebook.com/docs/marketing-api/audiences-api/websites#audiencerules" with no luck. I get the error "(#2654) Unsupported operator: The operator operator is not supported"

$params= [
            CustomAudienceFields::NAME           => $name . ' Tobi custom audience.',
            CustomAudienceFields::SUBTYPE        => 'WEBSITE',
            CustomAudienceFields::RETENTION_DAYS => 14,
            CustomAudienceFields::RULE           => [
                'inclusions' => [
                    'operator' => 'or',
                    'rules'    => [
                        [
                            'event_sources'     => [
                                [
                                    'id'   => $pixelId,
                                    'type' => 'pixel',
                                ],
                            ],
                            'retention_seconds' => 1209600,
                            'filter'            => [
                                'operator' => 'and',
                                'filters'  => [
                                    [
                                        'field'    => 'event',
                                        'operator' => 'i_contains',
                                        'value'    => 'AddToCart',
                                    ],
                                    [
                                        'field'    => 'event',
                                        'operator' => 'i_not_contains',
                                        'value'    => 'Purchase',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
            CustomAudienceFields::PREFILL        => '1',
            CustomAudienceFields::PIXEL_ID       => $pixelId,
        ];

        try {
            $audience = (new CustomAudience(null, 'act_' . $adAccountId));

            dd($audience->create($params));
        } catch (AuthorizationException $e) {
            print_r($e->getMessage());
            dd($e->getErrorUserMessage());
        }`
@elygiux
Copy link
Author

elygiux commented May 7, 2018

I tried example from https://developers.facebook.com/docs/marketing-api/audiences-api/websites#audiencerules but It doesn't work either. Call to undefined method FacebookAds\Object\CustomAudience::getResponse()

@miky9585
Copy link

+1

1 similar comment
@Ennazk
Copy link

Ennazk commented May 21, 2018

+1

@aalwash
Copy link

aalwash commented May 23, 2018

Any update on this?
I have the same issue

@Ennazk
Copy link

Ennazk commented May 23, 2018

The pixel_id outside of the "inclusions" object is not mentioned in the doc. This ended up working for me with the pixel_id only mentioned inside the "rules".

@aalwash
Copy link

aalwash commented May 23, 2018

You mean this one?
CustomAudienceFields::PIXEL_ID => $pixelId,

If I remove that one, I get a different error:
(#100) Pixel ID Required: pixel_id is required to create WCA

@aalwash
Copy link

aalwash commented May 23, 2018

Btw, this is how the bodyParams of the Facebook Request looks like:

 #bodyParams: FacebookAds\Http\Parameters {
      flag::STD_PROP_LIST: false,
      flag::ARRAY_AS_PROPS: false,
      iteratorClass: "ArrayIterator",
      storage: [
        "name" => "3 days purchase test",
        "description" => "Realtime audience. ID: 3532",
        "subtype" => "WEBSITE",
        "retention_days" => 3,
        "prefill" => true,
        "rule" => [
          "inclusions" => [
            "operator" => "and",
            "rules" => [
              [
                "event_sources" => [
                  [
                    "type" => "pixel",
                    "id" => 1234
                  ]
                ],
                "retention_seconds" => 2592000,
                "filter" => [
                  "operator" => "and",
                  "filters" => [
                    [
                      "field" => "event",
                      "operator" => "eq",
                      "value" => "PageView"
                    ]
                  ]
                ]
              ]
            ]
          ]
        ],

@Ennazk
Copy link

Ennazk commented May 23, 2018

If you are using V3.0, then you need to update your request by removing subtype, retention_days etc...

Here is the correct cURL request from the docs:

curl -X POST \ -F 'name=My Test Website Custom Audience' \ -F 'rule={"inclusions":{"operator":"or","rules":[{"event_sources":[{"id":"<PIXEL_ID>","type":"pixel"}],"retention_seconds":8400,"filter":{"operator":"and","filters":[{"field":"url","operator":"i_contains","value":"shoes"}]}}]}}' \ -F 'prefill=1' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v3.0/act_<AD_ACCOUNT_ID>/customaudiences

As you can see, everything (retention, pixel_id...) is set inside the "rule" object. Also there is no "subtype" anymore.

@aalwash
Copy link

aalwash commented May 23, 2018

Thank you, that fixed my issue! 👍

Now I will dig into the docs to find out how to provide all the necessary params (like you already mentioned, retention is now part of a ruleset)

@Ennazk
Copy link

Ennazk commented May 23, 2018

Awesome!

@ellentao
Copy link
Contributor

ellentao commented Jun 6, 2018

Thanks everyone for helping on this!

@ellentao ellentao closed this as completed Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants