facebook / facebook-ruby-business-sdk

Ruby SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
208 stars 161 forks source link

CustomAudience created via API can't be displayed in Facebook Ad Manager #55

Closed seattlecyclist closed 6 years ago

seattlecyclist commented 6 years ago

Hi,

I am creating a FB Custom Audience. It works fine but if I go to the FB Ad Manager and open the Audience and try to edit it. I get an error saying that the audience was created via the API and it can not show the details. I have attached my code and the error.

This seems like its so fundamental and googling for it results in no results for me, that I think something must be wrong. Is it possible to make a custom audience via an API and then edit OR even just view the rule details via FB Ads Manager

rule = {"inclusions":
          {"operator":"or",
           "rules": [
               {"event_sources":[
                   {"type":"pixel","id": pixel_id}
               ],
                "retention_seconds":2592000,
                "filter":{
                    "operator":"and",
                    "filters":[
                        {"operator":"or",
                         "filters":[
                             {"field":"url",
                              "operator":"i_contains",
                              "value":"lifting"
                             },
                             {"field":"url",
                              "operator":"i_contains",
                              "value":"Crossfit"
                             }
                         ]
                        }]
                },"template":"VISITORS_BY_URL"}]
          }
}

audience = @ad_account.customaudiences.create({ name: "Test Audience",
                                                prefill: true,
                                                rule: rule})

The error message from Facebook Ads Manager when I open the custom audience and try to edit it:

This rule was created through API or third party applications. It contains syntax that we currently don't support in our interface.
seattlecyclist commented 6 years ago

Closing. Found this document. https://developers.facebook.com/ads/blog/post/2018/06/13/sharing-custom-audiences/ I need to provide the relationship_type

shakeelm99x commented 5 years ago

Hi @seattlecyclist,

Could you please provide me an example of how to provide "relationship_type"? Thank you

TheTamFamily commented 4 years ago

Hi @seattlecyclist,

Did you manage to view the rule that was set via API in the Audience Manager. After using the relationship_type I'm still unable to view the rule. Could you paste the json in this message.

Thanks,

David

souldeux commented 2 years ago

Hello, people of the past and future. If you're anything like me then this issue was one of the most useful results you found when searching for this error.

If you're anything like me, relationship_type was not the issue and your hope quickly dissolved.

My issue, which I also see in the initial code snippet, was providing event_sources but no filter that indicated which event I wanted to filter on from those sources.

"rules": [
   {"event_sources":[
       {"type":"pixel","id": pixel_id}
   ],
    "retention_seconds":2592000,
    "filter":{
        "operator":"and",
        "filters":[
            {"field": "event", "operator": "eq", "value": "PageView"}, # This is new!
            {"operator":"or",
             "filters":[
                 {"field":"url",
                  "operator":"i_contains",
                  "value":"lifting"
                 },
                 {"field":"url",
                  "operator":"i_contains",
                  "value":"Crossfit"
                 }
             ]
            }]
    },"template":"VISITORS_BY_URL"}]
}

I tinkered around with relationship_type along with several other fields I found mentioned elsewhere: sub_type and customer_data_source. Including them doesn't break anything, but it doesn't fix anything either (in my case, at least).