Facebook Marketing API | Combine breakdowns - facebook-graph-api

Is it possible to combine breakdowns using the facebook marketing api? So far I can breakdown my reports by Age, Gender and Region, Country.
But would be nice if I could combine this four breakdowns. Because even having 2 separate reports I will never be able to get the accurate metric values, for example: clicks by Females from 18-25 living in Texas, USA.
I can only have:
Clicks by females from 18-25
Clicks from Texas, USA
Is there any way to achieve this.

No! Facebook only allows you to combine selected breakdowns like age and gender which you have already discovered.

you need create 2 diferent consult
$campaignparams['breakdowns'] = ['age','gender'];
$adsetparams ['breakdowns'] = ['country'];

Related

Google Places API gives name of the state as city in the suggestion

We are using google places API to autocomplete state, city or region searches. The issue is when one searches for a state, Places API gives two results one for the state and the other for the city/region. For eg, if we search Maine we get Maine, USA and Maine, ME, USA both in the response. Would anyone please provide a way to avoid this duplication?
Do you use "types" parameter?
https://developers.google.com/maps/documentation/places/web-service/autocomplete#types
"cities" type might give the result you want.

Querying earliest post of a Facebook user using Facebook Graph API or FQL

I would like to query earliest posts of a Facebook user using FQL or Graph API. The big issue is by default, Facebook limit return items, which are ordered by descending time.
I know I can limit my query by until, but I don't know what date to put in, because I have no idea when my user become Facebook member. I have to do search like:
find post until Jan 2006
if null, then find post until Jan 2007
if null, then find post until Jan 2008
....
which I hate so much.
Is there a smarter way to find out earliest posts by user?
First off, it's near impossible to have an all encompassing program that determines when a user joined Facebook, to put it quite bluntly. I know from your past questions, you have been trying but many have tried before you, it's not possible.
For example what happens if no one decides to write anything on my wall from the date I joined to 1 year after? That indicator becomes pretty inaccurate now does it?
Anything smarter is based on assumptions that may or may not hold true.
e.g.
Assumption 1: Every Facebook user would publish a post on or near when they joined
this give an initial guess based on A1
Assumptions 2: Given A1, any post by a friend on a user's wall that is posted before the unix time returned by A1 will be earlier in date
this will always be true as long as A1 holds.
All of this falls when there is a year between actual activity and join date.
You can minimize the set returned by calling less data per item and more items overall
/me/feed?fields=created_time&limit=200
Then you page until there is no next paging parameter left.
If you are indeed trying to find when did a user join Facebook, I agree with phwd's answer.
The best way I have been able to find out (which is also cheaper than having to reiterate through tons of posts) is accessing the earliest "profile pictures" of the user. This is making the assumption that a user would post a profile picture soon after creating their account.
Once you can get access to "Profile Pictures" album, you might be able to use created_time field for the album (or sort Profile Pictures by created_time for individual photos).
Even if the earliest photo was deleted, what are the chances that the user stays without any profile picture for a long time?
Reference:
https://developers.facebook.com/docs/graph-api/reference/v2.0/album

Get count of people who like two specific Facebook pages?

I know how to get the number of people who like a given page, what I'm looking for is how to get the count of people who like two specific pages. That is, can I get the number of people who like the pages (for example) Lady Gaga and Oreos? You can get the count for each very easily, but is there a way to figure out the number of people that overlap and like both? Not looking for the names or profiles, just the total count.
No. For privacy you can't get the list of Uids for each page's likes - so there is nothing to compare as you would need a list of Uids from both pages and then see which Uid's are in both lists.
See this post for more detail: How to list facebook users who like a page or interest
You can get the number of likes for a page via the Graph API Explorer. However, doing data mining like finding out the count of the number of people who overlap between the two pages is not released by Facebook. They get a lot of income from selling data points like that, so they're not going to let that cash cow out of their corrals.

Instant Video results

I am querying Amazon's Product Advertising API for Instant Video (streaming) results. Everything is working fine -- except that there is some missing information:
Descriptions are not included in results. For example, on Amazon's website the movie "Food, Inc" (http://www.amazon.com/Food-Inc/dp/B002VRZEYM) has the description "An unflattering look inside America's corporate controlled food industry.". When queried via the API, however, no description is returned at all.
Titles of TV shows are not included in results. For example, if you search for the 2nd episode of season 1 of Arrested Development (called "Top Banana") on Amazon's website (http://www.amazon.com/gp/product/B000N2VRJ8), you will get the full name of the TV show, season #, episode #, and episode name. When queried by the API, however, only the episode name is returned.
Does anyone know of a solution to these problems? FYI, the nodeId I am using for my search is 2858778011.
In order to get more details, you'll need to set the ResponseGroup parameter in your request. See the ResponseGroup section of the ItemLookup documentation to see the different Response Groups that you can use.
For example, setting the ResponseGroup parameter to Large or Medium or Small or even ItemAttributes will give you the description:
An unflattering look inside America's corporate controlled food industry.
for Food, Inc (B002VRZEYM) and the Title:
Top Banana
for Arrested Development season 1 episode 2 (B000N2VRJ8).
I had the same problem, while trying to query the Amazon API for Prime Instant Video content. Although this question is kinda old, there are probably some people like me who are interested in a detailed answer, especially for the second part (2.).
Like Jonathan Spooner already said, you have to set a response group
that returns the data you're interested in. Official documentation: Response Groups - Product Advertising API.
In your case, I think, the ResponseGroup Small should do.
If you want to get the title of a TV show, which contains a certain episode, you have to set the response group RelatedItems in your request, too (you can set multiple response groups in one request). You will also have to name a RelationshipType, otherwise the request will fail. For Episode -- Season - Relationships you choose Episode.
With RelatedItems, the result will contain a node named <RelatedItems>. You will find the season item in there, which's title should be something like " Arrested Development - Season 1 [HD]".
Note: If you really just want the TV show title, you could either parse the season name for it or you could make another ItemLookup with the seasons ASIN: set the response group RelatedItems again, but this time with RelationshipType=Season. This will return Season - TV Series - Relationships. The related item will contain the TV Show in general. (But the title could have a suffix like [HD] anyway)
Here you have a list with all relationship types: Relationship Types - Product Advertising API

Using Geo APIs to pick a random town from anywhere in the world

I'm trying to use Yahoo's excellent GeoPlanet API:
http://developer.yahoo.com/geo/geoplanet/guide/api-reference.html
I would like to pick a random town from anywhere in the world but can't see an easy way to do it. I have tried querying by country and asking for children of type 'town', but can't seem to do that directly.
Can anyone think of a way to pluck out a random town WOEID without having to query the country, then the admin regions, then the admin 2, then the admin 3 etc.
I have also experimented using YQL, but don't have enough of an understanding about the available APIs.
Have a look at http://world-gazetteer.com/.
You can store all towns in your local database, then do random select, and then just geocode selected town using any geocode service you like.
Just for phun, why not generate random lat/long & display whatever is there?