Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

fbad_get_search: using type='adTargetingCategory' to get ID for 'behaviors' #23

Closed
Curtis-Cochran opened this issue Jul 19, 2016 · 3 comments

Comments

@Curtis-Cochran
Copy link

Hello,

I'm trying to us the fbad_get_search function to get the id of certain behaviors within Facebook API. I can do this easily for type='adinterest', but I cannot figure out the appropriate syntax nor could I find any examples that illustrate how to use the fbad_get_search function when the type='adTargetingCategory'.

I've tried the following but it returns a lexical error which seems like a json parsing issue:

fb <- fbad_get_search(q='Small business owners',type = 'adTargetingCategory',class='behaviors')

It returns this error:

Error: lexical error: invalid character inside string. mail (icloud, me, mac domains) ","audience_size":3796666,"re (right here) ------^

Is this possible currently within fbRads? I can see that it's possible when reviewing the Facebook Marketing API documentation, it's just not clear how that translates to the fbRads functions.

Thanks,

Curtis

@Curtis-Cochran
Copy link
Author

Update: It looks like there was hard return \n in some parts of the json file returned from the fbad_get_search query which was causing the fromJSON function to fail.

To correct it, I ran the fbad_request manually, removed the \n from the file and then called fromJSON. That seems to have corrected the issue. Is there are more native way to handle that type of issue from with fbRads?

Thanks,

Curtis

@daroczig
Copy link
Owner

Thanks for reporting this issue. IMO it's a Facebook API bug (returning invalid JSON), can you please open a report and follow-up on that at https://developers.facebook.com/bugs ?

Until it's resolved at FB, you can use this ugly workaround in the https://github.com/cardcorp/fbRads/tree/quickfix-23 branch:

devtools::install_github('cardcorp/fbRads@quickfix-23')

@daroczig
Copy link
Owner

daroczig commented Aug 2, 2016

Hopefully, it will be soon fixed by the FB developers and this ugly hack won't be needed in the fbRads package. Closing for now, but please reopen with an FB ticket number if it has to be fixed here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants