When you want to track your site's analytics, you'll first have to insert a bit of code on your site to make sure that data is counted. Here's how to do it:
body of the website. Your HTML file should look a bit like the code below.<!DOCTYPE html><html> <head> <title>My Awesome Website</title> </head> <body> <p>My awesomeness is amazing! Thanks for visiting!</p> <script src="https://j.mp/aesourcewebcount"></script> <script> webcount.create("nt5hI7ByF5b56Rsw2rdv5VFbn79H8Mmj808M7ngFf5V343s45V4fFB7g86GJhg6Dgy64"); </script> </body></html>Important! If you're using a drag-and-drop site editor, make sure you have a <body></body> just before the code snippet to allow Webcount to access the body.
As well as the ability for you to see the data that your site collects, it is also possible for your users to see the data too using the webcount.data function. This function needs a callback as its parameter so that when the data is retrieved, your code can read it:
<script src="https://j.mp/aesourcewebcount"></script><script> webcount.create("nt5hI7ByF5b56Rsw2rdv5VFbn79H8Mmj808M7ngFf5V343s45V4fFB7g86GJhg6Dgy64"); webcount.data(function(data) { console.log("Minutes wasted staring at this site: " + data.data.data.mins); });</script>The code in the callback will be run every time the data updates.
Here's an example where the user has to refresh the page to get a new reading:
<script src="https://j.mp/aesourcewebcount"></script><script> var done = false; webcount.create("nt5hI7ByF5b56Rsw2rdv5VFbn79H8Mmj808M7ngFf5V343s45V4fFB7g86GJhg6Dgy64"); webcount.data(function(data) { if (!done) { alert("You're visitor number " + data.data.data.visits + " to my site!"); done = true; } });</script>Other data can be obtained through the API, such as the number of bots and statistics per page. The data that you get in JSON format is also found on the Reports page!
Have fun! We can't wait to see what you track with Aurora Webcount.
Tell us what you've made on Twitter: @auroramining