Browser attribution script (analytics.js)

Persist the clickId from short-link redirects using analytics.js and send it to conversion endpoints.

Overview

The browser attribution script (/analytics.js) captures the hoko_id query parameter that Hoko appends to destination URLs and stores it as a cookie. This gives you a persistent clickId that you can send later when tracking leads or sales.

What it does

  • Reads hoko_id from the current page URL
  • Stores it in a cookie named hoko_id for 90 days
  • Replaces the existing hoko_id cookie when the current page URL contains a new hoko_id
  • Does not send any network requests

Lightweight by design

The script only writes the cookie. It does not call any tracking endpoints automatically.

Add the script

Include the script on pages where users land after clicking a Hoko short link.

Code html
<script src="https://hoko.to/analytics.js" defer></script>

When it runs

The script runs when the browser loads it. It must execute on the same domain where you want the cookie to be stored.