Getting Age of Visitor on Website [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I need to write some code that gets the gender and age of a visitor on my website without asking for permission to store them, just like Google Analytics.
I have managed figure out a way of getting the users gender using by using the Facebook Graph API (gender does not require user permission). So now I am stuck on a way I could get the visitors age as I cannot use Facebook Graph API for this as it requires permission from the user to get.
Any ideas? Thanks for reading.

Here is a function that is just as accurate as Facebook but requires no user permissions.
function get_age() {
return Math.floor(Math.random() * (100 - 13) + 13);
}
If you want more accuracy, you can use multiple random numbers to skew the data into a more realistic distribution. See the jsfiddle I put together: http://jsfiddle.net/D7sj6/

Related

Counting High Quality visitor for ads [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I Started to make a website that provide a shortlink with ads and then pay the publisher , but for advertiser they only want real people to see their persuasive ads , so my problem is how to know the viewer is real people and high quality enough to make the counter count them so i can give reward to the publisher ,
sorry if you don't understand my english is bad
THANKYOU VERY MUCH
There is some small REST API doing great IP verification returning a score for the IP you send, example :
$ip = $_SERVER['REMOTE_ADDR'] ; // your user IP
$checkIp = file_get_contents('http://check.getipintel.net/check.php?ip='.$ip.'&contact=mail#example.com') ;
// don't forget to put a real e-mail
if ($checkIp <=0.95) {
// this user is not a bot !
// do something here
}
Then you can save the result in a session or a cookie so you don't have to call API on every page. I use to work with http://getipintel.net/ but based on the same idea you can use google invisible captcha.

How can I register how many times a 'user' visits a website? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'd like parts of my website to be non-visible to the user if the user has accessed the website more than a certain number of times. The NY Times website has similar functionality.
I use react & firebase.
I did think about getting a user's IP address but my understanding is that measures geography, not necessarily a device.
P.S. If this question's unsuitable for SO, would you mind suggesting another forum, if you know of one, where it'd be more suitable?
You can use js and the local storage of the client browser to do that the easy way (but it can be easily cheated on by cleaning history).
Just copy/past that in an .html file and it will work if you refresh more then 4 times :
<script>
var dontDisplayPage = false;
if (localStorage.getItem('numberViews') === null){
localStorage.setItem('numberViews', 1);
} else {
localStorage.setItem('numberViews', parseInt(localStorage.getItem('numberViews'), 10) + 1);
}
if(parseInt(localStorage.getItem('numberViews'), 10)>4){
dontDisplayPage = true;
}
if(dontDisplayPage) alert('too many views !');
</script>
Then looking at dontDisplayPage you know if you must display the page, here dontDisplayPage is true if page has been seen more 4 times.
Based on that you can hide the div containing the article for exemple and display a message.

It's possible to record leads analytics about "Source", "Medium" and "Campaign" on a Custom HTML Form? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I know that this question is kinda weird but I have a CRM platform integrated with a MySQL database.
In this way, each new row in the MySQL database is a lead in the CRM system but now I need to track all information related with source, ect... from that lead and seems like a complicated task but don't really know if is possible.
I have hours looking for a solution and still haven't found anything useful.
You have to replicate programmatically what Google Analytics do and save value in cookie or database.
For example, when user lands on website with UTM in the URL you can get that values, if there aren't UTM you can check if there is gclid parameter in the URL so it will be google / cpc, if there isn't that parameter you can check document referral, if it is google.com your source and medium will be google / organic, alternatively website / referral.
You save the data the first time and pass it in the form. This is the principle makes use of.

Make an search engine and get result based on the frequency of search [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to make a search for my website to search the user form my database. Let say I want maybe the most popular or searched user be search priority instead of some no name guy and without using other search engine api/framework. I rather doing this with my finger. So how can i acheive it?I using php for server side ,javascript client side,mysql for database.
In your database add score column and add +1 to it whenever user is visited from search results.
After that simply add ORDER BY score DESC to your query when displaying results.

How to make an automatic country finder [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am making a registration page on my website.
I don't want my users to type their own country. I am wondering how to make a PHP/JS/jQuery script that will work with this:
<input type="hidden" name="country" value="!!COUNTRY CODE HERE!!">
If you want to get the users country, you're going to need to do it with (qualified) guess using their IP address - see this question and answer for an easy PHP-script for doing so.
If this is for a user registration page and the users country is important to get right, though, I would recommend a dropdown-menu where the users can choose the country for themselves instead. Guessing which country a user is from based on their IP isn't guaranteed to be correct every time. Some people might be using static IP addresses or VPNs or some proxy of sorts, which would give you a wrong result.

Categories