Event Model
GoSquared's event tracking is real-time and person-based. Every event fires immediately to the GoSquared dashboard (no batching or processing delay) and is attached to the current visitor's profile. This makes GoSquared events particularly useful for:
- Live monitoring — watch user actions as they happen in the real-time dashboard.
- People CRM enrichment — events build a behavioral profile for each identified visitor.
- Smart group segmentation — create dynamic segments based on event history (e.g., "users who triggered 'Purchased' in the last 30 days").
- Live chat triggers — initiate chat prompts based on specific user actions.
Tracking Events
Basic Events
// Simple event (name only)
_gs('event', 'Signed Up');
// Event with properties
_gs('event', 'Signed Up', {
plan: 'Pro',
source: 'website',
referrer: document.referrer
});
Event naming conventions:
- Use past tense for completed actions:
Signed Up,Purchased,Exported Report. - Use present tense for ongoing states:
Viewing Pricing,Browsing Category. - Be specific:
Clicked Upgrade CTAis more useful thanButton Click. - Keep names consistent —
Signed Upandsigned upare different events.
Common Event Patterns
// SaaS signup funnel
_gs('event', 'Visited Pricing');
_gs('event', 'Started Trial', { plan: 'Pro' });
_gs('event', 'Completed Onboarding', { steps_completed: 5 });
_gs('event', 'Upgraded', { plan: 'Pro', revenue: 49.99 });
// E-commerce
_gs('event', 'Product Viewed', {
product_id: 'SKU-123',
product_name: 'Blue Widget',
category: 'Widgets',
price: 29.99
});
_gs('event', 'Added to Cart', {
product_id: 'SKU-123',
quantity: 2,
cart_value: 59.98
});
// Feature adoption (SaaS)
_gs('event', 'Used Feature', {
feature: 'Data Export',
format: 'CSV',
rows_exported: 5000
});
User Identification
Events are only tied to a named person after you call identify. Without identification, events are tracked against an anonymous visitor ID.
// Identify after login or signup
_gs('identify', {
id: 'user_12345', // Required: unique, stable user ID
email: 'jane@example.com', // Recommended: enables People CRM features
name: 'Jane Smith',
custom: {
plan: 'Enterprise',
company: 'Acme Corp',
signup_date: '2025-01-15'
}
});
When to call identify:
- Once after authentication — GoSquared persists the identity in a cookie.
- After form submission where email is captured.
- Never with different IDs for the same visitor in one session.
Identity merging: When you identify a previously anonymous visitor, GoSquared retroactively associates all their anonymous events with the identified profile.
Updating Properties
Properties describe who the person is and persist on their profile:
_gs('properties', {
plan: 'enterprise',
seats: 25,
mrr: 499,
last_login: new Date().toISOString()
});
Transaction Tracking
GoSquared has a dedicated transaction method for revenue tracking:
// Basic transaction
_gs('transaction', {
id: 'order_123', // Unique ID for deduplication
revenue: 99.99,
quantity: 1
});
// Transaction with line items
_gs('transaction', {
id: 'order_456',
revenue: 249.99,
items: [
{ name: 'Pro Annual License', price: 199.99, quantity: 1 },
{ name: 'Priority Support Add-on', price: 50.00, quantity: 1 }
]
});
Transaction vs. event: Use _gs('transaction') for purchases — it feeds GoSquared's revenue dashboard and per-person lifetime value. Use _gs('event') for non-revenue actions.
SPA Page Tracking
Single-page apps need manual tracking on route changes:
// Basic — tracks current URL and title
_gs('track');
// Explicit URL and title
_gs('track', '/dashboard/settings', 'Account Settings');
Framework Integration
// React Router
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
function useGoSquaredTracking() {
const location = useLocation();
useEffect(() => {
if (typeof _gs === 'function') {
_gs('track', location.pathname, document.title);
}
}, [location]);
}
// Vue Router
router.afterEach((to) => {
if (typeof _gs === 'function') {
_gs('track', to.path, to.meta.title || document.title);
}
});
Smart Groups (Segmentation)
In GoSquared Dashboard → People → Smart Groups, create dynamic segments based on event history:
Example segments:
- "Trial users who haven't purchased in 14 days" → churn risk.
- "Users who used Export 5+ times" → power users for upsell.
- "Visitors who viewed pricing 3+ times without signing up" → trigger live chat.
Smart groups update in real-time. Use them to trigger Slack notifications, auto-send chat messages, or sync to CRM integrations.
Live Chat Triggers
Connect events to GoSquared's live chat for contextual engagement:
- Dashboard → Engage → Automations.
- Trigger: "Visitor fires
Viewed Pricingmore than 2 times." - Action: Automated chat message — "I see you're exploring pricing. Can I help answer questions?"
- Target: Only anonymous visitors not yet in conversation.
Debugging Events
// Enable debug mode
_gs('debug', true);
// Fire a test event — watch console for outbound request
_gs('event', 'Debug Test', { source: 'manual' });
// Verify GoSquared loaded
console.log(typeof _gs); // 'function' = loaded
Real-time verification: GoSquared Dashboard → Now → Activity Feed shows events as they fire. Open your site in one tab and the dashboard in another to validate instantly.
Best Practices
- Identify users before high-value events. Events before identification are captured but attributed to anonymous IDs. Later identification retroactively links them.
- Include context in properties.
_gs('event', 'Purchased')is less useful than addingplan,revenue, andsourceproperties. - Don't track everything. Focus on events that represent business value. Page views are automatic.
- Use transactions for revenue. The
_gs('transaction')method feeds dedicated revenue reporting that_gs('event')does not. - Test in a staging project. Create a separate GoSquared project for staging to avoid polluting production data.