This document describes how the HockeyStack website tracking pixel is deployed and emphasizes the customer's complete control over when and how the pixel fires.
Overview
The HockeyStack pixel is a lightweight JavaScript tracking script that enables website analytics and event tracking. The pixel is designed to give customers full control over when tracking events fire, making it compatible with various deployment scenarios and privacy requirements.
Deployment Methods
Customers have two primary deployment options, both of which provide complete control over when the pixel fires:
1. Direct Page Deployment
Deploy the pixel directly in your website's HTML by inserting the tracking script into the <head> section of your pages.
✅ When the script loads: Control via async loading, conditional logic, or tag manager triggers
✅ When page views fire: Control via script loading timing, tag manager triggers, or disabling automatic tracking
✅ When custom events fire: Full programmatic control via HockeyStack.goal() and HockeyStack.identify() API calls
✅ Deployment flexibility: Works whether deployed directly on the page or through any tag manager
✅ Privacy compliance: Control tracking based on consent status, user preferences, or any custom condition
The pixel is designed to be customer-controlled at every level—from when it loads to when it fires events. This gives you the flexibility to integrate HockeyStack tracking in a way that matches your technical requirements, privacy policies, and business needs.
This document describes how the HockeyStack website tracking pixel is deployed and emphasizes the customer's complete control over when and how the pixel fires, whether deployed directly on the page or through a tag manager.
<script>
// Only load the pixel after user consent
if (userHasConsented()) {
var hsscript = document.createElement("script");
hsscript.src = "<https://cdn.jsdelivr.net/npm/hockeystack@latest/hockeystack.min.js>";
hsscript.async = 1;
hsscript.dataset.apikey = "YOUR_API_KEY";
document.getElementsByTagName('head')[0].append(hsscript);
}
</script>
// Fire a custom event whenever you want
HockeyStack.goal('Button Clicked', {
buttonId: 'signup',
page: '/pricing'
});
// Fire after a specific user action
document.getElementById('cta-button').addEventListener('click', function() {
HockeyStack.goal('CTA Clicked', {
buttonText: this.textContent,
section: 'hero'
});
});
// Identify a user when you have their information
HockeyStack.identify('[[email protected]](<mailto:[email protected]>)');
// Identify with properties
HockeyStack.identify({
email: '[[email protected]](<mailto:[email protected]>)',
plan: 'premium',
signupDate: '2024-01-15'
});
// Fire events based on any condition
if (purchaseCompleted) {
HockeyStack.goal('Purchase Completed', {
amount: orderTotal,
items: itemCount
});
}
// Fire only after consent
if (consentGranted) {
HockeyStack.identify(userEmail);
}