Get an email when a REAL PERSON (not a bot) visits your personal/business website!
A small piece of JS that will track page scrolling and clicks, and send an AJAX request (and send you an email) This project will be the easiest to implement if you are already using jQuery and PHP.
The first time a user scrolls on your page, you will be sent an email (Sorry, just visiting the page will not send an email!). The scroll event trigger will only occur once. Then, when the user clicks on the DOM element of your choice, you will be sent another email. You can have the text of any DOM element sent to you, so you have an idea of where users are clicking on your website.
There are 2 lines you will need to change. Both involve deciding which DOM object you want to use as a "trigger" for the AJAX request. (Also called adding an Event Listener to a DOM object).
Choose your element that will trigger the AJAX request. (js.js, line 20)
$(document).on("mouseenter touchstart", "YOUR DOM ELEMENT HERE", function(e){
Choose your element ( if different ) to send as the text data. (js.js, line 22)
var dataString = $("YOUR DOM ELEMENT HERE (DOES NOT HAVE TO BE THE SAME)").html();
Add your email address (sendMeAnEmail.php, line 7):
mail('/* email goes here BETWEEN quotes, delete stars and slashes */', $emailSubject, $emailBody);
Add to the directory where your url(website) exists.
Add this line to your html(website url), either at the end of the 'body', or where the other JS files are loaded. <script src="js.js"></script>