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

Glitch with the job_type() parameter in the fbInsights() fucntion #9

Closed
tokumotion opened this issue Feb 2, 2016 · 1 comment
Closed

Comments

@tokumotion
Copy link

Taken from #7

When trying to run fbInsights(), the parameter fields= is converted to JSON, but when running the code this happens:

fbInsights(target = id, fields = toJSON(c(impressions, clicks)), job_type = "async") 

You get this error:

Error: Argument 'txt' must be a JSON string, URL or file.
Called from: base::stop(..., call. = FALSE)

If I enclose the job_type = "async" inside the toJSON() command, the function returns the correct result.

fbInsights(target = id, fields = toJSON(c(impressions, clicks), job_type = "async")) 
@daroczig
Copy link
Owner

daroczig commented Mar 9, 2016

Sorry for the long delay with my reply, I've just seen your ticket -- not sure how I missed the notification on this. I think the problem with your above call is that you are not quoting the fields, eg:

toJSON(c('impressions', 'clicks'))

So R is trying to look up the impressions and clicks objects. Can you please verify if you have this issue with the quotes as well? Another issue might be that clicks is not a valid field as per https://developers.facebook.com/docs/marketing-api/reference/ads-insights/, so you may want to include eg unique_clicks.

Can you please reopen the ticket with more details after verifying the above?

@daroczig daroczig closed this as completed Mar 9, 2016
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