RangeWorks Analytics Integration Guide
Last updated: June 1, 2025
This guide demonstrates how to integrate RangeWorks booking widgets with popular analytics platforms to track user interactions and conversions.
Overview
RangeWorks widgets support analytics callbacks that fire when users interact with embedded booking forms. These callbacks pass structured event data to your parent page, allowing you to track conversions in your analytics platform.
Basic Setup
<div id="rangeworks-classes" class="section-normal" style="background-color:transparent;"></div>
<script type="text/javascript" src="https://rangeworks.us/rangeworks_consumer_iframe.js"></script>
<script type="text/javascript">
window.RangeWorks.init({
id: "rangeworks-classes",
business: "your-business-slug",
module: "training/",
analyticsCallback: function(eventData) {
// Your tracking code here
}
});
</script>
Event Data Structure
All analytics events include:
{
eventType: 'resourceListView' | 'resourceListSelect' | 'resourceView' | 'openCheckout' | 'completeCheckout',
timestamp: number,
resource?: {
id?: number | string | null,
name?: string,
type: 'class' | 'rangeLaneReservation' | 'membership',
slug?: string,
price?: number
}
}
Google Analytics 4 (GA4) Integration
Setup
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');
</script>
Analytics Callback Implementation
window.RangeWorks.init({
id: "rangeworks-classes",
business: "your-business-slug",
module: "training/",
analyticsCallback: function(eventData) {
const { eventType, resource, timestamp } = eventData;
switch(eventType) {
case 'resourceListView':
gtag('event', 'view_item_list', {
item_category: resource?.type || 'unknown',
timestamp: timestamp
});
break;
case 'resourceView':
gtag('event', 'view_item', {
item_id: resource?.id?.toString(),
item_name: resource?.name,
item_category: resource?.type,
value: resource?.price || 0,
currency: 'USD'
});
break;
case 'openCheckout':
gtag('event', 'begin_checkout', {
item_id: resource?.id?.toString(),
item_name: resource?.name,
item_category: resource?.type,
value: resource?.price || 0,
currency: 'USD'
});
break;
case 'completeCheckout':
gtag('event', 'purchase', {
transaction_id: `rw-${resource?.id}-${timestamp}`,
item_id: resource?.id?.toString(),
item_name: resource?.name,
item_category: resource?.type,
value: resource?.price || 0,
currency: 'USD'
});
break;
}
}
});
Facebook Pixel Integration
Setup
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>
Analytics Callback Implementation
window.RangeWorks.init({
id: "rangeworks-classes",
business: "your-business-slug",
module: "training/",
analyticsCallback: function(eventData) {
const { eventType, resource } = eventData;
switch(eventType) {
case 'resourceView':
fbq('track', 'ViewContent', {
content_ids: [resource?.id?.toString()],
content_type: 'product',
content_name: resource?.name,
content_category: resource?.type,
value: resource?.price || 0,
currency: 'USD'
});
break;
case 'openCheckout':
fbq('track', 'InitiateCheckout', {
content_ids: [resource?.id?.toString()],
content_type: 'product',
value: resource?.price || 0,
currency: 'USD'
});
break;
case 'completeCheckout':
fbq('track', 'Purchase', {
content_ids: [resource?.id?.toString()],
content_type: 'product',
value: resource?.price || 0,
currency: 'USD'
});
break;
}
}
});
Google Tag Manager Integration
Analytics Callback Implementation
window.RangeWorks.init({
id: "rangeworks-classes",
business: "your-business-slug",
module: "training/",
analyticsCallback: function(eventData) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'rangeworks_event',
rangeworks_event_type: eventData.eventType,
rangeworks_resource_type: eventData.resource?.type,
rangeworks_resource_name: eventData.resource?.name,
rangeworks_resource_price: eventData.resource?.price,
rangeworks_timestamp: eventData.timestamp
});
}
});
Adobe Analytics Integration
window.RangeWorks.init({
id: "rangeworks-classes",
business: "your-business-slug",
module: "training/",
analyticsCallback: function(eventData) {
if (typeof s !== 'undefined') {
s.linkTrackVars = 'events,eVar1,eVar2,eVar3,prop1';
s.linkTrackEvents = 'event1,event2,event3';
switch(eventData.eventType) {
case 'resourceView':
s.events = 'event1';
s.eVar1 = eventData.resource?.type;
s.eVar2 = eventData.resource?.name;
s.prop1 = eventData.resource?.id?.toString();
s.tl(this, 'o', 'RangeWorks View');
break;
case 'completeCheckout':
s.events = 'event3,purchase';
s.eVar3 = eventData.resource?.price?.toString();
s.tl(this, 'o', 'RangeWorks Purchase');
break;
}
}
}
});
HubSpot Integration
window.RangeWorks.init({
id: "rangeworks-classes",
business: "your-business-slug",
module: "training/",
analyticsCallback: function(eventData) {
if (typeof _hsq !== 'undefined') {
switch(eventData.eventType) {
case 'resourceView':
_hsq.push(['trackEvent', {
id: 'rangeworks_view',
value: eventData.resource?.price || 0,
resource_type: eventData.resource?.type,
resource_name: eventData.resource?.name
}]);
break;
case 'completeCheckout':
_hsq.push(['trackEvent', {
id: 'rangeworks_purchase',
value: eventData.resource?.price || 0,
resource_type: eventData.resource?.type,
resource_name: eventData.resource?.name
}]);
break;
}
}
}
});
Multi-Platform Integration Example
window.RangeWorks.init({
id: "rangeworks-classes",
business: "your-business-slug",
module: "training/",
analyticsCallback: function(eventData) {
const { eventType, resource, timestamp } = eventData;
// Google Analytics 4
if (typeof gtag !== 'undefined') {
switch(eventType) {
case 'completeCheckout':
gtag('event', 'purchase', {
transaction_id: `rw-${resource?.id}-${timestamp}`,
value: resource?.price || 0,
currency: 'USD'
});
break;
}
}
// Facebook Pixel
if (typeof fbq !== 'undefined') {
switch(eventType) {
case 'completeCheckout':
fbq('track', 'Purchase', {
value: resource?.price || 0,
currency: 'USD'
});
break;
}
}
// Custom tracking
console.log('RangeWorks Analytics Event:', eventData);
}
});
Event Types Reference
Event TypeDescriptionTypical Use | ||
| User views list of available classes/memberships | Track page views, engagement |
| User selects item from list | Track user interest, funnel progression |
| User views individual class/membership details | Track product views, retargeting |
| User initiates checkout process | Track checkout starts, abandoned carts |
| User completes purchase | Track conversions, revenue |
Best Practices
Test thoroughly - Always test your analytics implementation in a staging environment
Error handling - Wrap analytics calls in try-catch blocks to prevent widget errors
Data validation - Check for required properties before sending events
Performance - Keep analytics callbacks lightweight to avoid impacting widget performance
Privacy compliance - Ensure your tracking complies with GDPR, CCPA, and other privacy regulations
Troubleshooting
Common Issues
Events not firing: Check browser console for JavaScript errors
Missing data: Verify the resource object contains expected properties
Multiple events: Ensure you're not double-tracking events across platforms
Debug Mode
analyticsCallback: function(eventData) {
console.log('Debug - RangeWorks Event:', eventData);
// Your analytics code here
}