{"repo":"ankane/ahoy.js","free":true,"listed":false,"github":"https://github.com/ankane/ahoy.js","clone":"git clone https://github.com/ankane/ahoy.js.git","description":"Simple, powerful JavaScript analytics","language":"JavaScript","stars":509,"topics":["analytics","first-party-analytics","visits","events"],"license":"MIT","category":"analytics","readme_excerpt":"Ahoy.js :fire: Visit and event tracking for JavaScript - Easily track unique visitors - Track events across page navigation Use it with any backend. For Rails, check out the Ahoy gem. Installation Download ahoy.js and include it on your page. Or use Yarn: And import it with: How It Works When someone lands on your website, they are assigned a visit token and a visitor token. The visit token expires after 4 hours, in which a new visit is created. Visits are useful for tracking metrics like monthly active users. The visitor token expires after 2 years. A POST request is sent to /ahoy/visits with: - visit token - visitor token - referrer - landing page The server can capture: - ip - user agent - user - from app authentication And calculate things like: - referring domain and search keyword from referrer - utm source, utm medium, utm term, utm content, and utm campaign from landing page - city, region, and country from ip - browser, os, and device type from user agent Events Track events with: A POST request is sent to /ahoy/events with: - name - properties - time The server can capture: - visit token - from cookies - user - from app authentication As a precaution, the server should reject times that do not match: Views Name - $view Properties - url - https://www.streamflip.com - title - Streamflip - page - / The page defaults to the path. Set the page with: Clicks Name - $click Properties - tag - a - id - account-link - class - btn btn-primary - page - / - text - View Account - ","default_branch":null,"files":null,"tree":[],"storefront":"/r/ankane","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ankane/ahoy.js/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}