I'm creating a campaign through Facebook Marketing API and need to specify region codes. How can I easily find these codes?
I'm planning on hard-coding these region codes, so I'm looking for a quick solution, like manually planning a Facebook ad and retrieving these codes from the URL or from a post/get action. Any hacks you know off?
Answering my own question :)
Region codes can be retrieved using Facebook Graph Explorer as follows:
search?type=adgeolocation&location_types=region&country_code=US
Related
Is it possible to programmatically analyze facebook trade groups? If yes, could you point me to a tutorial?
Edit: OK, seems like it's illegal per Facebook Terms of Service. I guess this makes the question irrelevant: https://www.facebook.com/apps/site_scraping_tos_terms.php
As Wizkid mentioned, facebook does not provide an api for fetching other people's facebook page content.
You can access plenty of information about your own Facebook Page using the Graph API, but not pages you dont have permissions on.
Programmatically accessing the page content of pages outside the graph api violates the facebook TOS, which will result in banning.
I'm looking for a way to find most shared/liked/commented facebook post of a location (country/city) by calling facebook api?
Is this possible to create through the Facebook API? I could not find how to pull information in general that many websites offer.
Any help would be greatl! Thanks
No, there is no direct possibility to do that. You can only get Pages/Places by location (Search API), read their feed (/page-id/feed), go through the posts and calculate on your own.
I'm developing an app in which the user needs to search and select a person from Facebook. I'm able to search in the Facebook Graph API using "https://graph.facebook.com/search", however this only give very general results and not the 'close' people Facebook would normally suggest when searching in the search field on Facebook.com. In this case it is impossible to find someone with a regular name.
Does anybody know how I can personalize my query or go around this problem?
The Graph API search is not the same nor directly comparable to the search in the Facebook website.
See
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.3#search
The new graph search on facebook page allows you to search for current employees of a company by typing a query like "Current Google employees" on the top search bar.
Now how to do the same via Graph API? Or if not possible via Graph API, then I am thinking of scrapping it using say, Scrapy, but then it redirects me to the login.php page. Any help would be appreciated.
Thanks
It's not possible via Graph API based on how permissions and privacy in the API work.
I am not rolled out to Graph Search but I'm guessing each query has a specific page and you can use Scrapy to pull it. The reason you are being redirected is because you don't have the proper headers and cookies (such as dtsg and datr) to see the page. You need Scrapy to impersonate the user of the page.
Though, it wouldn't make sense building an application like this. The whole point of the API is so that you don't scrape pages without their permission. This sounds like a sure way to ask for a cease and desist once you usage is noticable.
I want to add the 'Log in with Facebook' option to my website, however I'm unsure how to integrate the information gained when someone logs into my website with Facebook with my current Google Analytics.
Is it possible to link up a visit in Google Analytics with a user who has logged into the site with Facebook to enable me to see things like age, gender etc?
Any help you can give me on this would be much appreciated.
Thanks,
Ben
you may have to do this via a redirection or possibly a frame.
Google Analytics does nolt track individual users, it provides anonymized data. So at the top level, no you cannot do this. However, there are a few more things avaiable to you. One: Facebook provides facebook insights, their own tracking suite, that will give you demographic information on the users of a facebook app or fan page. You site will effectively become a facebook app when you use their user authenication, so you will be able to get insights tracking on you site. At the present moment, facebook insights and google analyitcs do not itegrate or share data. Facebook insight also provides anonymized data, so you will not be able to identify an individual through the tracking.
The final option is, now that you are tracking users through login, you can implement your own tracking info on your site to see what individual users are doing, and attempt to track their preferences.
Its also entirely legal (in the United States at least) to buy access to marketing data and use use your registered user name pool to get additional information.
If you wanted, you could set up a "funnel" in Google.
When a user logs in through Facebook, you could send them to a specific page and then track their progress from there...
http://www.google.com/support/analytics/bin/answer.py?answer=55515
So using this you could get the percentage of users who log in through Facebook... etc.
But to collect information other than that, you would have to get the correct permissions documented here eg. user_birthday (to get the user's Birthday) and query the Graph API from there, thus implementing your own tracking of users.
You can query the Graph API using the various SDKs that Facebook provide explained here.
First of all you should check out this Google document. It explains, how you set a custom unique user id via google analytics.
Further you've to send an event to google analytics (e.g. 'fb_login') via the callback function of your facebook login function.