Skip to content

Get an email when a REAL PERSON (not a bot) visits your personal/business website!

Notifications You must be signed in to change notification settings

Seanmcdon/visitor-movement-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

visitor-movement-tracker

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.

Summary:

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.

1. Download and edit the files

js.js

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();

php

Add your email address (sendMeAnEmail.php, line 7):

mail('/* email goes here BETWEEN quotes, delete stars and slashes */', $emailSubject, $emailBody);

2. Add files

Add to the directory where your url(website) exists.

3. Edit the html to include js.js

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>

About

Get an email when a REAL PERSON (not a bot) visits your personal/business website!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published