Documentation
Setup guides and reference documentation to help you get the most from TrueTracked.
Pixel Installation
Install the TrueTracked tracking pixel on your website to start collecting first-party data for accurate attribution. Choose the installation method that best fits your setup.
Prerequisites: You need a TrueTracked account with a workspace ID. Find your workspace ID in your Settings > Pixel Installation page.
Method 1: Manual Installation (Insert Code)
Add the tracking script directly to your website's HTML. This works with any website or CMS.
- Add the base loader script — Paste the following code before the closing
</head>tag on every page of your site:
<script>
!function(t,r,u,e){t.truetracked=t.truetracked||function(){
(t.truetracked.q=t.truetracked.q||[]).push(arguments)};
var s=r.createElement("script");s.async=1;
s.src=u;r.head.appendChild(s)}
(window,document,"https://t.ttrkd.com/tt.js?w=YOUR_WORKSPACE_ID");
</script>Replace YOUR_WORKSPACE_ID with your actual workspace ID from Settings.
- Track events — The SDK automatically tracks page views. For eCommerce events, add calls like:
// Product viewed
truetracked("event", "product_viewed", {
items: [{
id: "SKU-123",
name: "Product Name",
price: 29.99
}]
});
// Add to cart
truetracked("event", "add_to_cart", {
items: [{
id: "SKU-123",
name: "Product Name",
price: 29.99,
quantity: 1
}]
});
// Checkout completed
truetracked("event", "checkout_completed", {
order_id: "ORD-456",
value: 59.98,
currency: "USD",
items: [{
id: "SKU-123",
name: "Product Name",
price: 29.99,
quantity: 2
}]
});Method 2: Shopify Installation
For Shopify stores, add the pixel to your theme's theme.liquid file.
- In your Shopify admin, go to Online Store > Themes
- Click Actions > Edit code
- Open the
theme.liquidfile - Paste the base loader script before the closing
</head>tag - Save the file
Shopify's checkout events are handled automatically via webhooks. See the Integrations guide to connect your Shopify store.
Method 3: Google Tag Manager
If you use GTM, you can install TrueTracked without modifying your website code directly.
- In GTM, create a new Custom HTML tag
- Paste the base loader script (same as Method 1) into the tag
- Set the trigger to All Pages
- Create additional Custom HTML tags for each eCommerce event you want to track
- Use GTM's Preview mode to test, then publish
Tip: For Shopify stores using GTM, use GTM variables to pull data from Shopify's data layer. Common variables include ecommerce.products and ecommerce.purchase.
Using a Custom Domain
If you've set up a custom tracking domain, the script URL changes. Instead of using the default t.ttrkd.com domain, you'll use your custom subdomain:
<script>
!function(t,r,u,e){t.truetracked=t.truetracked||function(){
(t.truetracked.q=t.truetracked.q||[]).push(arguments)};
var s=r.createElement("script");s.async=1;
s.src=u;r.head.appendChild(s)}
(window,document,"https://YOUR-CUSTOM-DOMAIN/tt.js");
</script>Note that with a custom domain, you don't need to include the workspace ID in the URL — it's resolved automatically from the domain.
SPA (Single Page Application) Considerations
For React, Next.js, Vue, or other SPA frameworks, the SDK automatically detects route changes and tracks page views. No additional configuration is needed for client-side navigation.
For frameworks using custom routers, you can manually track page views:
// Call after each route change
truetracked("event", "page_viewed");Debug Mode
Enable debug mode to see tracking events logged in your browser console:
truetracked("debug", true);Troubleshooting
- Script not loading: Check that the script is placed before
</head>and your workspace ID is correct. - Events not appearing: Enable debug mode and check the browser console for errors. Ensure your ad blocker isn't blocking requests to
t.ttrkd.com. - Ad blockers blocking the script: Set up a custom tracking domain to bypass ad blockers.
- Duplicate page views in SPAs: The SDK handles this automatically. If you see duplicates, make sure you're not manually calling
page_viewedin addition to the auto-tracking.
SDK Methods Reference
| Method | Description |
|---|---|
truetracked("event", name, data) | Track a custom event with optional data payload |
truetracked("debug", true/false) | Enable or disable debug logging |
truetracked("getDecoratedUrl", url) | Get a URL decorated with cross-domain tracking parameters |