A detailed guide to installing the Datahappy JavaScript Pixel on your website.
PROJECT_ID
in the Datahappy dashboard.
<head>
section in your site’s HTML templates.
<head>
tag for all pages on your site. This is often in a file like index.html
, _document.js
, base.html
or header.php
</head>
tagYOUR_PROJECT_ID
to your actual Project ID<head>
and not at the end of the <body>
. Placing it in the head ensures it loads as early as possible, which is essential for accurately capturing attribution data from the very first page view.window.datahappy
object: This object contains all the methods you’ll use to interact with the SDKdatahappy.buffered
) so that any API calls you make (like datahappy.track()
) before the full SDK has loaded are safely storeddatahappy.load()
command injects a <script>
tag that fetches the full SDK from our CDN without blocking the rendering of your pagedatahappy.init("YOUR_PROJECT_ID")
tells the SDK which project configuration to load from our serversdatahappy.page()
is called to record the initial page view, capturing the crucial first-touch attribution data