Integrations
Connect Rehearsals with your existing tools and workflows.
Analytics Platforms
Google Analytics 4
Send session data to GA4 for unified analytics.
// Initialize after both GA4 and Rehearsals load
window.rehearsals?.identify(userId, {
ga_client_id: ga.getAll()[0].get('clientId')
});
// Send session ID as custom dimension
gtag('event', 'page_view', {
'rehearsals_session_id': window.rehearsals.sessionId
});
// Track Rehearsals events in GA4
window.rehearsals.on('event', (event) => {
gtag('event', 'rehearsals_' + event.name, event.properties);
});
Google Tag Manager
Rehearsals automatically pushes events to the dataLayer.
// Available in dataLayer
dataLayer.push({
'event': 'rh_session_started',
'rh_session_id': 'sess_abc123',
'rh_user_id': 'user_123'
});
GTM Variable Configuration:
- Create Variable: Data Layer Variable
- Variable Name:
rh_session_id
- Use in tags to enrich other tools
Segment
Track Rehearsals sessions in Segment.
// After Segment loads
analytics.ready(() => {
// Send session ID with all events
analytics.track('Session Started', {
sessionId: window.rehearsals.sessionId,
recordingUrl: `https://app.runrehearsals.com/sessions/${window.rehearsals.sessionId}`
});
});
// Enrich Segment identify
analytics.identify(userId, {
...traits,
rehearsals_session: window.rehearsals.sessionId
});
Mixpanel
Include session data in Mixpanel events.
// Set super properties
mixpanel.register({
'rehearsals_session_id': window.rehearsals.sessionId
});
// Track with session context
mixpanel.track('Purchase', {
amount: 99.99,
rehearsals_session: window.rehearsals.sessionId
});
Amplitude
Enrich Amplitude events with session data.
// Set user property
amplitude.getInstance().setUserProperties({
rehearsals_session: window.rehearsals.sessionId
});
// Include in events
amplitude.getInstance().logEvent('checkout_started', {
rehearsals_session_id: window.rehearsals.sessionId,
recording_active: window.rehearsals.isRecording()
});
Customer Support Tools
Intercom
Display session links in Intercom conversations.
// Pass session ID to Intercom
window.Intercom('update', {
rehearsals_session: window.rehearsals.sessionId,
recording_url: `https://app.runrehearsals.com/sessions/${window.rehearsals.sessionId}`
});
// Custom attribute for support
window.Intercom('trackEvent', 'issue-reported', {
session_recording: window.rehearsals.sessionId
});
Zendesk
Include session data in support tickets.
// Add to Zendesk Web Widget
zE('webWidget', 'helpCenter:setSuggestions', {
labels: [`session:${window.rehearsals.sessionId}`]
});
// Prefill ticket fields
zE('webWidget', 'prefill', {
ticket: {
fields: {
description: `Session Recording: https://app.runrehearsals.com/sessions/${window.rehearsals.sessionId}`
}
}
});
Freshdesk
Attach session data to tickets.
// Custom fields in widget
window.FreshworksWidget('identify', 'ticketForm', {
rehearsals_session: window.rehearsals.sessionId,
recording_url: `https://app.runrehearsals.com/sessions/${window.rehearsals.sessionId}`
});
Error Tracking
Sentry
Enrich error reports with session recordings.
import * as Sentry from '@sentry/browser';
Sentry.init({
beforeSend(event) {
event.contexts = {
...event.contexts,
rehearsals: {
sessionId: window.rehearsals?.sessionId,
recordingUrl: `https://app.runrehearsals.com/sessions/${window.rehearsals?.sessionId}`,
isRecording: window.rehearsals?.isRecording()
}
};
return event;
}
});
Bugsnag
Add session context to error reports.
Bugsnag.start({
onError: function(event) {
event.addMetadata('rehearsals', {
sessionId: window.rehearsals?.sessionId,
recordingUrl: `https://app.runrehearsals.com/sessions/${window.rehearsals?.sessionId}`,
userId: event.user?.id
});
}
});
LogRocket
Coordinate with LogRocket sessions.
// Link LogRocket and Rehearsals sessions
LogRocket.getSessionURL((sessionURL) => {
window.rehearsals.trackEvent('logrocket_session', {
url: sessionURL
});
});
// Share user identification
LogRocket.identify(userId);
window.rehearsals.identify(userId);
A/B Testing Tools
Optimizely
Track experiments with recordings.
// Get active experiments
const state = window.optimizely.get('state');
const experiments = state.getActiveExperimentIds();
const variations = state.getVariationMap();
// Send to Rehearsals
window.rehearsals.trackEvent('optimizely_experiments', {
experiments: experiments,
variations: variations
});
Google Optimize
Track Optimize experiments.
// Listen for Optimize activation
gtag('event', 'optimize.callback', {
callback: (value, name) => {
window.rehearsals.trackEvent('google_optimize', {
experiment: name,
variant: value
});
}
});
VWO
Track VWO campaigns.
// Get campaign info
window._vwo_exp_ids.forEach(campaignId => {
const variation = _vwo_exp[campaignId].combination_chosen;
window.rehearsals.trackEvent('vwo_campaign', {
campaignId: campaignId,
variation: variation
});
});
E-commerce Platforms
Shopify
For Shopify Plus stores with custom checkout:
<!-- In theme.liquid -->
<script>
window.deepPredictionSettings = {
apiKey: 'dp_proj_xxxxx',
organizationId: 'dp_org_xxxxx'
};
// Track Shopify events
{% if checkout %}
window.rehearsals?.trackEvent('checkout_started', {
value: {{ checkout.total_price | money_without_currency }},
items: {{ checkout.line_items.size }}
});
{% endif %}
{% if customer %}
window.rehearsals?.identify('{{ customer.id }}', {
email: '{{ customer.email }}',
orderCount: {{ customer.orders_count }}
});
{% endif %}
</script>
WooCommerce
// In functions.php
add_action('wp_head', function() {
?>
<script>
window.deepPredictionSettings = {
apiKey: 'dp_proj_xxxxx',
organizationId: 'dp_org_xxxxx'
};
<?php if (is_user_logged_in()): ?>
window.rehearsals?.identify('<?php echo get_current_user_id(); ?>');
<?php endif; ?>
<?php if (is_checkout()): ?>
window.rehearsals?.trackEvent('checkout_page_viewed');
<?php endif; ?>
</script>
<?php
});
Magento
<!-- In default_head_blocks.xml -->
<referenceBlock name="head.additional">
<block class="Magento\Framework\View\Element\Template"
name="rehearsals.script"
template="Vendor_Module::rehearsals.phtml"/>
</referenceBlock>
CRM Integration
Salesforce
Send session data to Salesforce:
// Using Salesforce Web-to-Lead
document.getElementById('lead-form').addEventListener('submit', (e) => {
const hiddenField = document.createElement('input');
hiddenField.type = 'hidden';
hiddenField.name = 'rehearsals_session__c';
hiddenField.value = window.rehearsals.sessionId;
e.target.appendChild(hiddenField);
});
HubSpot
Track in HubSpot:
// HubSpot Forms API
window.addEventListener('message', (event) => {
if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
window.rehearsals.trackEvent('hubspot_form_submitted', {
formId: event.data.id
});
}
});
// Pass session to HubSpot
var _hsq = _hsq || [];
_hsq.push(['identify', {
rehearsals_session: window.rehearsals.sessionId
}]);
Custom Integrations
Webhook Integration
// Send session data to your backend
window.rehearsals.on('session_ended', async (data) => {
await fetch('/api/rehearsals-webhook', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sessionId: data.sessionId,
duration: data.duration,
events: data.events
})
});
});
Custom Analytics
// Build your own analytics integration
class RehearsalsAnalytics {
constructor() {
this.sessionId = window.rehearsals?.sessionId;
this.events = [];
}
track(eventName, properties) {
const event = {
name: eventName,
properties: properties,
timestamp: Date.now(),
sessionId: this.sessionId
};
this.events.push(event);
window.rehearsals?.trackEvent(eventName, properties);
// Send to your analytics
this.sendToAnalytics(event);
}
sendToAnalytics(event) {
// Your implementation
}
}