Hi townsendmtonline,
Currently, in Office 365 SharePoint website, there are no official documents and methods suggesting using code to achieve the website analytics goal. If you would like to know the detailed information about SharePoint Online sites being visited, I suggest you access Web Analytics Reports to check that information.
To access Web Analytics Reports, please append the URL of your site with /_layouts/usage.aspx (http://<domain>.sharepoint.com/_layouts/usage.aspx or http://www<domain>.com/_layouts/usage.aspx).
Then click Activity. It shows information on how often this site is being visited.
Thanks,
Kevin Cui