Installation
Add this code snippet to every page you want to track, just before the closing</head> tag:
Where to Find Your Pixel ID
- Log in to app.upstackdata.com
- Navigate to Settings → Pixel
- Copy your pixel ID (format:
px_abc123def456)
Where to Place the Code
Standard Websites
Place the snippet in your site’s<head> section on every page:
Single Page Applications (SPAs)
For React, Vue, Next.js, or other SPAs:- Add the snippet once in your main
index.htmlor root layout - Track route changes manually (page views don’t fire automatically on navigation)
Google Tag Manager
If you prefer GTM, create a Custom HTML tag:- Create a new tag with type Custom HTML
- Paste the installation snippet
- Set trigger to All Pages (or your preferred trigger)
- Publish the container
Verifying Installation
Browser Console Check
Open your browser’s developer console (F12) and run:Test a Page View
Manually fire a page view and check the Network tab:upstackified.com or upstackdata.com in the Network tab.
Pixel Helper Extension
Install the Upstack Pixel Helper Chrome extension for real-time event monitoring without using the console.Quick Start: Common Tracking Patterns
Track a Page View
Track a Product View
Track Add to Cart
Track a Purchase
Identifying Users
User identification improves match quality with ad platforms and enables cross-device tracking.Basic Identification
Important:
emails and phones are arrays, not single strings. This supports users with multiple contact methods.When to Identify
Callidentify() when you capture user information:
- Newsletter signup form submission
- Account registration
- Checkout (when email is entered)
- Login
Complete E-commerce Example
Here’s a full example tracking the customer journey:Troubleshooting
Pixel Not Firing
Check if the script is loading
Check if the script is loading
Open Network tab in DevTools and look for
ups.min.js. If it’s not loading:- Verify the script URL is correct
- Check for ad blockers or privacy extensions
- Ensure the snippet is in the
<head>, not blocked by CSP
Check initialization
Check initialization
Run in console:All should return
true after the page loads.Verify pixel ID
Verify pixel ID
Ensure your pixel ID:
- Starts with
px_ - Matches exactly what’s in your dashboard
- Has no extra spaces or characters
Check for JavaScript errors
Check for JavaScript errors
Look for errors in the Console tab. Common issues:
- Calling
_upstackbefore defining the queue function - Syntax errors in your tracking code
- Conflicts with other scripts
Events Not Appearing in Dashboard
Wait a few minutes
Wait a few minutes
Events can take 1-5 minutes to appear in the dashboard. Check the Live Events view for real-time data.
Check the Network tab
Check the Network tab
Look for outgoing requests after firing an event. You should see a POST request to the tracking endpoint.
Verify event names
Verify event names
Use standard event names like
page_view, view_content, add_to_cart, purchase. Custom event names work but may not map to standard destination events.Check for bot detection
Check for bot detection
The pixel automatically filters bot traffic. If you’re testing with automated tools, events may be ignored.
Common Mistakes
| Issue | Solution |
|---|---|
Using upstack() instead of _upstack() | The correct global is window._upstack() with underscore |
Passing email instead of emails: [] | Identity fields use arrays: { emails: ['user@example.com'] } |
Missing currency on purchase events | Always include currency: 'USD' (or your currency code) |
Missing order_id on purchases | Include for deduplication across browser/server events |
| Not tracking SPA navigation | Call _upstack('page') on route changes |
Related Documentation
JavaScript SDK Reference
Full API documentation for all methods and options.
Standard Events
Reference for all standard event types and their properties.
Properties & Context
Complete reference for item arrays, customer data, and auto-captured fields.
Identity Resolution
How user identification enables cross-device tracking.
Custom Events
Create events beyond the standard taxonomy for your needs.
Connect Destinations
Send events to Meta, Google, TikTok, Klaviyo, and more.