🔍 Overview
Buyhatke provides a single JavaScript file (b.js) that you embed once in your website's global
template.
The script reads the URL on each page load and, when a Buyhatke referral parameter is detected, silently
notifies
Buyhatke's API — no cookies, no pop-ups, no effect on page performance.
The script is completely silent on errors: it will never throw an exception or affect your page in any way.
⚡ Integration Steps
-
Add the script tag Paste the snippet below into your site's global layout template, just before the closing
</body>tag. -
Call
BuyhatkeTracker.init()Pass the URL parameter name and value provided by Buyhatke (defaults are shown below and work for most partners). -
Deploy & verify Open any page on your site with
?utm_source=buyhatkein the URL and confirm there are no console errors.
<!-- Step 1: Load the Buyhatke script (before </body>) --> <script src="https://pixel.buyhatke.com/b.js"></script> <!-- Step 2: Initialise with your configuration --> <script> BuyhatkeTracker.init({ key: 'utm_source', // URL query parameter to check value: 'buyhatke' // Expected value of that parameter }); </script>
🌏 Place it globally
Add the snippet to your site's global layout / master template so it is present on every page —
not just the homepage. Buyhatke links can deep-link to any product or category page.
ℹ️ Default parameters
Only change
key or value if Buyhatke has explicitly provided you with different parameter names. For most partners the defaults — key: 'utm_source', value: 'buyhatke' — are correct as-is.
⚙️ Configuration Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key |
string | Yes | The URL query parameter name to check (e.g. utm_source). |
value |
string | Yes | The value that parameter must equal for the script to activate (e.g. buyhatke). |