I need to create a Google map that would display all my app users. The problem is, that that Facebook doesn't seem to provide enough information to do that, country at most. I'd like to display user position on map at least to the proximity of the city.
The only option I see, is to track user's location using their IP. What are the other options?
If the user has provided it, you can get their current location (city, state, country) by prompting for the 'user_location' and/or 'friends_location' permissions.
You might also want to check out the 'user_checkins' and/or 'friends_checkins' permissions for more timely and accurate locations.
http://developers.facebook.com/docs/reference/api/user/
Or as a fallback, like you say, you can usually get an approximate location by their IP. But that's not always very accurate.
Related
I would like to let users use Google Maps in my store application to find all of my stores along a specified route.
This is the flow I envision:
User creates a starting point and an endpoint for a trip.
User selects a distance from the route that they would be comfortable traveling to get to one of our stores. This would be in miles, say, from 1 to 50 miles.
Given those parameters, Google Maps displays the route along with markers for all stores within those parameters.
User then can click on the stores they want to visit while driving to the destination.
When they are done, my program will generate a list of all the stores they have selected along their route.
A couple of notes:
I have a database of all of our stores that includes city, state, zip, lat, long. It can also contain all of the info that I want returned to the user when the list of stores are selected on the route such as hours, services, etc.
I just need to know if this functionality is possible within the Google Maps api.
I am looking for a automatic way to link a website visitors's location to regionally limited content (not based on distance from lat/lon). The content is generated by a static site generator for each countries' province and will be delivered to the user from Amazon AWS. (Cloudfront I guess, we haven't yet decided precisely) provinces will each have their own static directory and for instance be accessed through their own url (//province.website.country)
So for instance a visitor from Beieren, Germany, must see only content that is published to Beieren, when the enter "website.de", get redirected to the beieren sub-url.
A possible solution is to present the user with a map in which they click on their region. However, we prefer to do this automatically when the information is present in the request headers/ip info.
I wonder what methods are out there except from comparing huge lists of ip ranges to ip/location databases and then getting the province from that location. For instance we are willing to use perverted methods like requesting google user data. But perhaps Amazon AWS provides a way to do this. We haven't been able to find it.
Most of all, we are looking for the fastest and most reliable way.
AWS does not provide any method of doing this.
Further, without asking the user where they are you generally have to rely on their IP address which is only really accurate in giving you the location of their ISP. I've seen IP address based geolocation be wildly inaccurate, so I wouldn't rely on it for anything important. If a user is on a mobile device you might be able to request GPS coordinates, but the user could always deny that request.
I would like to keep track of IP addresses visiting my site, as it helps determine what content I should host.
I a really not a programmer, so i was looking for a pre-built solution.
I found this script:
<?php
$LogFileLocation = "/public_html/cms/iplog.txt";
$fh = fopen($_SERVER['DOCUMENT_ROOT'].$LogFileLocation,'at');
fwrite($fh,date('dMy H:i:s')."\t".$_SERVER['REMOTE_ADDR']."\t".$_SERVER['REQUEST_URI']."\n");
fclose($fh);
?>
however when i created iplog.txt and browse to it, nothing happens.
If you need only statistic of visiting of your site why you don't use Google Analitics (http://www.google.com/analytics/)? It gives full information on how to track visits onto the site. Your method gives you only text file with date, user's ip and page which user visited; but if you aren't a programmer, you will not sort this information and operated this data.
If you still decide to use your method of store information and don't want to use Google Analitics, then save data about user and visited pages in the database in special created table (id, date, ip, uri). This method will permit show date-statistic, statistic for ip and single page.
You can capture IP of the visitor with the following code.
$ip=$_SERVER['REMOTE_ADDR'];
Now you can store it in your database. For that you have to create a column in your database table that stores the ip address. Along with IP address, you can store many other information in the database for keeping track of users like time stamp, duration, page visits etc. There are many tools available like Google Analytic and others which provide you such services free of cost but they don't store the record in your website's database. So choose accordingly.
I would like to know if is there any possible way to show the total number of users of a specific country in my webpage. As far as I found, you can not get it through API.
I'm guessing you really want the total number of users on facebook who have 'liked' or used facebooks oauth to connected with your site.
Do you use graph api in your site? I'm pretty sure you can query by country name--as long as the user's who have shared that info with you have provided it.
Check this out... http://developers.facebook.com/docs/reference/api/
And this: http://developers.facebook.com/docs/reference/api/insights/
From their site
Facebook Insights provides the ability to see geographic and
demographic data for people that have Liked a Page or installed an
app. Location data is based on the geographic location of each person
as determined by their browser IP address and is limited to the top 20
countries and cities. All other demographic information is aggregated
and non-personally identifiable.
Generic searches can be done like this:
https://graph.facebook.com/search?type=location&place=166793820034304
Where the place id is the id for whatever you want to search on.
https://graph.facebook.com/search?type=location&place=166793820034304
Disclamer: This method is not supported by Facebook. Use it at your own risk. I take no responsibility whatsoever.
Go to: https://www.facebook.com/ads/manage/adscreator/
Fill in the ad info with something random (eg. google.com as the url)
In the next part you'll notice a dynamic reach estimation that changes depending on the parameters you select, including country. Try changing the country and observe the network activity with for instance the developers tools of Google Chrome.
Call the ajax url that returns the json data with the proper parameters programatically, this should be easy to figure out in the previous step.
Collect and store the json data for your evil deeds.
???
PROFIT!
The actual ajax call and parameters change from time to time, which is why I didn't include them directly, but it should be easy enough to figure it all out. Also note that they are estimates, even if they come from Facebook, they don't count every single user every time an advertiser sets up an ad — it's the best estimate you can possibly get though.
This method as I mentioned is neither official nor supported by Facebook, but sites like socialbakers.com or checkfacebook.com have been using them for ages. (There, I revealed the secret)
I am a web developer and I want to design a commercial website to sell a customer's product. Sell and buy activities are important and I need to maintain user activity information to keep the site secure.
I want to write a dynamic website. I want to control all user activity and then decide whether to save user activity information in a database. Some of site's visitors are registered users and some are anonymous. I want to save online information such as ip address, username, page name, and date/time for my registered users.
I want to know:
How do I save a user's IP address?
What more do I need to save?
Saving each HTTP request details into database will work for low traffic web sites, but you will have performance issues in case of popular website, since writing to database in relatively slow operation.
Why not to use server HTTP logs instead?
All HTTP web servers create plain text log files which record remote user IP address, URL requested, etc. You can create activity report by writing your own script or using log file report tools. AWStats ( http://awstats.sourceforge.net/ ) is one of the most popular open-source tools for this.
On client side you can use Google Analytics to track user activity. It also provides means to track custom events:
_gaq.push(['_trackEvent', 'login', 'user_login', "custom data"]);
More info at: http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html
This option only tracks users with JavaScript enabled, so it won't show bots, crawlers or users having analytics blocking addons installed.
I'm not sure I understand all of your question...but to address at least one aspect of it, if the user is behind a proxy, then you have no way of determining what their real IP is. That's the whole point. The proxy is the one making the request and then forwarding it. Without asking the proxy yourself, you cannot determine that. With regards to what else you need to save, it depends entirely on what you want to do and you haven't done a good job of explaining why you are saving this data. If you can clarify that, perhaps we can help you a bit more in determining what data you should be saving.
Edit To address your clarification, if you wanted to be crazy, you could log everything that a person does. Every link they click, every product they view, etc. I don't necessarily advocate that as I find it a bit creepy, but there are definitely sites that do it. At the bare minimum, I would suggest logging what products people look at and then what products they buy. I would also log that information on a per-session basis. Basically, what products do people look at and then end up buying on the same trip to your store. I wouldn't worry too much about the "real" IP address. Most people won't be behind a proxy and those that are, you can't do anything about anyway.
How do I save a user's IP address?
$_SERVER['REMOTE_ADDR']
What more do I need to save?
That's quite strange question. It's your application, not someone's else. How can we guess what information you need?
However, at least one issue I can point out: a page name is not sufficient to log "all user activity". Query string and POST data usually contains important details on that activity.