Appearance
Script tag
Use this when you have no build step. It works on any site that lets you add a script.
html
<script
src="https://app.justonecx.qd.je/sdk/justonecx-sdk.global.js"
data-public-key="pk_your_workspace_key"
data-api-url="https://api.justonecx.qd.je"
></script>Place it before </body>. The script reads its own data-* attributes and starts by itself.
Attributes
| Attribute | Required | Description |
|---|---|---|
data-public-key | Yes | Your workspace public key. |
data-api-url | Yes on real sites | Backend origin. Without it the SDK uses http://localhost:8000, which only works for local development. |
data-track-route-changes | No | Set to "true" on sites that change pages without a full reload. |
Pin a version
The URL above always serves the latest SDK and is cached for five minutes. To avoid surprises, pin a version. A pinned file never changes:
html
<script
src="https://app.justonecx.qd.je/sdk/justonecx-sdk.v0.1.0.global.js"
data-public-key="pk_your_workspace_key"
data-api-url="https://api.justonecx.qd.je"
></script>See SDK versions.
Calling the API
The script adds window.JustOneCX:
js
window.JustOneCX.identify("user-42", { plan: "growth" });
window.JustOneCX.track("clicked_upgrade");
window.JustOneCX.reset();Calls made before the script has loaded fail. Place your own code after the script tag, or run it after the load event.
Platform notes
- WordPress: add the snippet with a header/footer plugin, or in your theme's
footer.phpbeforewp_footer(). - Webflow: Project settings → Custom code → Footer code.
- Shopify: edit
theme.liquidand paste the snippet before</body>. - Google Tag Manager: use a Custom HTML tag that fires on all pages. Add
data-track-route-changes="true"if the site is a single-page app.