Google Tag Manager (GTM)
Your Workspace Id
You can find your Workspace Id on your Workspace's settings page. It should start with "ws_".
Installing Spectacle with Google Tag Manager
The Spectacle GTM template provides a complete analytics integration without requiring manual code implementation. You can track page views, identify users, record events, and link users to organizations through Google Tag Manager's interface.
Before you begin
- Get your Workspace Id: Find your Workspace Id on your Workspace's settings page
- Access to GTM: Ensure you have admin access to your Google Tag Manager container
- Plan your tracking: Consider what events you want to track and when they should fire
Step 1: Import the Spectacle GTM Template
- In Google Tag Manager, go to Templates in the left sidebar
- Click Search Gallery in the Tag Templates section
- Search for "Spectacle" and select the official Spectacle template
- Click Add to workspace to import the template
Step 2: Create a Spectacle Tag
- Go to Tags and click New
- Click Tag Configuration and select Spectacle from the Custom templates section
- Configure your tag based on your tracking needs:
Required Configuration
- Workspace Id: Enter your Workspace Id (starts with "ws_")
- Spectacle Method: Choose from four tracking methods:
- Page: Track page views (recommended for most sites)
- Identify: Identify users with traits
- Track: Track custom events
- Group: Associate users with organizations
Method-Specific Configuration
Page Method (Automatic Page Tracking)
No additional configuration needed. The template automatically collects page URL, title, referrer information, UTM parameters, and device data.
Advanced Options
- Auto Track Forms: Automatically track form submissions as Identify events (when an email is found in form data) and as Track events. This option is enabled by default.
Identify Method (User Identification)
- User Id (required if no Email): Unique identifier for the user
- Email (required if no User Id): User's email address
- First Name: User's first name
- Last Name: User's last name
- User Traits: Additional custom properties (key-value pairs)
Track Method (Custom Event Tracking)
- Event Name (required): Name of the event (e.g., "Trial Started", "Form Submitted")
- Revenue: The revenue in cents associated with this event (e.g., 19999 for $199.99)
- Currency: The three letter currency code (e.g., "EUR" or "USD")
- Event Properties: Custom event data (key-value pairs)
Group Method (Organization Association)
- Group Id (required): Unique identifier for the organization
- Group Traits: Organization properties (key-value pairs)
Step 3: Configure Triggers
Set up triggers to determine when your Spectacle tags should fire:
For Page Tracking
- Trigger Type: Page View
- Trigger Fires On: All Pages (or specific pages as needed)
For User Identification
- Trigger Type: Custom Event or Page View
- Trigger Fires On: When user data is available (e.g., after login)
For Event Tracking
- Trigger Type: Click, Form Submission, Custom Event, etc.
- Trigger Fires On: When the specific action occurs
For Group Association
- Trigger Type: Custom Event or Page View
- Trigger Fires On: When organization data is available
Step 4: Test Your Implementation
- Preview Mode: Use GTM's Preview mode to test your tags
- Debug Mode: Enable Debug Mode in the Spectacle tag to see console logs
- Check Firing: Verify that tags fire on the correct triggers
- Validate Data: Ensure the correct data is being sent to Spectacle
Step 5: Publish Your Changes
Once testing is complete:
- Click Submit in GTM
- Add a descriptive version name and description
- Click Publish to make your changes live
Common Use Cases
Basic Website Tracking
Create a tag with Method: Page and Trigger: All Pages
Lead Generation Tracking
Create a tag with Method: Track, Event Name: "Lead Generated", and appropriate form submission triggers
E-commerce Conversion Tracking
Create a tag with Method: Track, Event Name: "Purchase", include revenue and currency properties
User Identification After Login
Create a tag with Method: Identify, include User Id and email, trigger on login success
Revenue Tracking
For revenue events, include revenue and currency properties in your Track events. Spectacle will automatically use this data for ROAS calculations on your dashboard.
Troubleshooting
Tag Not Firing
- Check trigger configuration
- Verify trigger conditions are met
- Use GTM Preview mode to debug
Data Not Appearing
- Confirm Workspace Id is correct
- Check browser console for errors (enable Debug Mode)
- Verify network requests are being made
Next Steps
Once your GTM implementation is live:
- Monitor your Spectacle dashboard for incoming data
- Set up additional events as needed
- Configure attribution models and reporting preferences