Onboarding & Integration Guide
The Apptrove WebSDK is a lightweight, asynchronous JavaScript library designed to track user sessions and conversion events within Progressive Web Apps (PWAs) and websites. It enables attribution by generating a unique session identifier and syncing it with user-defined actions.
Installation & Initialization
To integrate the SDK, place the following script as high as possible in the <head> section of your HTML. This ensures the tracker initializes before other page elements load.
Implementation Script:
<script>
!(function (e, n, t, s, a, o, A, c, T) {
(e.ATSdkObject = "AT"),
(e.AT =
e.AT ||
function () {
(e.AT.q = e.AT.q || []).push(
[Date.now()].concat(Array.prototype.slice.call(arguments))
);
}),
(e.AT.id = e.AT.id || A),
(e.AT.plugins = {}),
(c = n.createElement(t)),
(T = n.getElementsByTagName(t)[0]),
(c.async = 1),
(c.src =
"https://websdk.apptrove.com?" +
(o.length > 0 ? "st=" + o.split(",").sort().join(",") + "&" : "") +
(A.length > 0 ? "at_id=" + A : "")),
T.parentNode.insertBefore(c, T);
})(window, document, "script", 0, "AT", "pwa", {
pwa: { siteId: "YOUR_APP_ID", mode: "live" } // mode: "live" | "testing"
});
</script>
Replace "YOUR_APP_ID" with the SDK Secret Key provided in your Apptrove Dashboard.
mode here only controls the automatic page-visit beacon — set it to "testing" on a staging/QA environment to keep that traffic out of live reporting. It does not apply to identify or trackEvent; those need their own mode passed on each call. See Event Tracking.
SDK Secret Key — Apptrove Dashboard:
