Facebook Graph API: is User Locale Automatically Determined by Geolocation Check? - facebook-graph-api

After doing my research, I could not get an answer for this question:
When a developer gets the locale field from the User object, does this locale is based on the user's said country on their profile? Or does Facebook do a geolocation check based on the user's IP for each session to determine the locale?
This is important since I need to know how realiable the locale field is.
EDIT: So, it all appears that this locale field is indeed based on the user's said locale on their profile (see Richard's answer below). Is there a way to get a geolocation-checked country code from the FB Graph API?

User.locale corresponds to the display language the user has selected, eg via the link at the bottom of the home page.
If I change my language from English to Indonesian, for example, my locale changes to id_ID.

Related

Fetch facebook user's locale - Graph API

I have a data collection application from facebook, it worked very well a few days ago. Currently,it's work, but cannot get the locale field to classify data.
I use Graph API:
https://graph.facebook.com/v2.6/<user_id>?fields=first_name,locale&access_token= <access_token>
Is there any way to solve this problem?
Not only locale is deprecated for today. More information you can check here
https://developers.facebook.com/blog/post/2018/05/01/facebook-login-updates-further-protect-privacy/
If you are using web canvas app, you can get current user locale from POST request, which facebook platform do each time when your app started. So you can find 2 fields: signed_request, fb_locale. It works only for current user but still. Maybe this information will be usefull.
If you have mobile app or something else you should try investigate this trick. It works for me.

What happens to a User-ID in google analytics when the user clears the cookie?

I am trying to implement the user ID feature in Google Analytics to track user behaviour across devices. I know that the client ID gets cleared once the user clears the ga cookie.
What happens to the user ID in this case? Is it tied to the authentication system and hence not dependent on the cookie? Can someone throw some light on this?
You have to generate a unique user id for ervery user and store it.
Everytime the user logs in to you site, you have to set correct the user id.
Take a look to this document.
Google Documentation
The id that you will pass should be a unique id from your system that persists.
If the user clears their cookies, it will not matter because the user id will reset once they access a page next time.

Facebook comments - gender and location of users

Is there a way to get additional data for users that commented on a post on Facebook? So far I'm getting the message, the id and name of the user with this:
GET https://graph.facebook.com/POST_ID/comments?fields=message,from.id,from.name
I would like to additionally fetch from.gender and from.location, but this does not seem to work. Is there any other way?
The from object for a given comment only contains id and name elements.
id in the from object pertains to the user who posted a given comment. Once you have id you can query the graph API again against that user for their user details. However, you may or may not be able to retrieve location for any given user: their privacy settings may or may not expose it, or you may not have adequate permissions to retrieve more than the most generic information for that user.
You should always be able to retrieve gender and locale from a given user's endpoint in the API, however. Not that I would rely on locale for location information per se, but it may be at least marginally useful depending on your needs.

FQL Javascript Bug Workaround: Search for id from name

Is there a workaround for the current bug in FQL: http://developers.facebook.com/bugs/266794040030851?browse=search_4f2ff35cf1e521b94883666
The idea would be to request SELECT id FROM user WHERE name="First last" but there is currently a bug in the index such that you can't search by name.
I need to find someones facebook id from their full-name, preferably ordered by mutual friends. I've tried the facebook search api but haven't found it reliable.
Thanks!
Actually there is an ugly workaround but you have to go outside FQL:
https://graph.facebook.com/search?fields=id,name,link&q=|name|&type=user&access_token=MY_VALID_ACCESS_TOKEN
Using search API this might work, where there is |name| you should just put "Name Surname".
EDIT:
Beware: A facebook app cannot have MORE privileges than a facebook user, ok I'm expanding what I'm trying to say: As you know a facebook user can modify his account settings in order to be NOT visible in public search that means EVERY search will not display that particular user... if the user you are trying to search has this particular setting, then you won't see him, not even through FQL!
This is where a facebook user can set this

Django and a referrer system implementation

I am trying develop a basic referrer system to my Django website, system will be generating a unique url for each users to share with their friends. Once these friends enter this website, system somehow keep the data that "this user is browsing by the reference of X user" and once this invited person decided to register for an account, system will save this information (maybe as an extra Foreign Key of the inviting user in the UserProfile model)
Now how can I keep track of the inviting user from the moment entering using the referred link to the point where he/she registers to the site. Would session framework work on this? If not how could this be done ?
I implemented this feature in my book 'Django 1.0 Website Development'. You can view the relevant chapter online at 'inviting friends via email'.
I used the sessions framework to track clicks on referral links. When a link is clicked, the session is populated with the id of the invitation. When the user registers, the session is checked for an invitation id.
The formatting of the code is a bit off on that page. I've just noticed this. I will let the publisher know. You can download the source code with proper formatting from the book's page.