Skip to main content

Required Settings

These settings must be provided for Rehearsals to function:
apiKey
string
required
Your project API key (starts with dp_proj_)Get this from your Rehearsals Dashboard
organizationId
string
required
Your organization ID (starts with dp_org_)Get this from your Rehearsals Dashboard

Optional Settings

User Identification

In order for Rehearsals to automatically find preferential data, we need to identify customers and match them against our Rehearsals internal database. This enables our AI to provide personalized insights and identify user-specific patterns. You can identify customers in two ways:
  1. Visual Events - Rehearsals can automatically extract user information from your UI (e.g., elements displaying user emails or names)
  2. Programmatic Identification - Send user data directly using the Identity API for more control
The Identity API also allows you to set custom IDs to identify customers, ensuring consistency with your existing systems.

Identity API

Learn how to identify users and track behavior across sessions and devices

Quick Example

// After user logs in
rehearsals.identify('user-123', { 
  email: 'user@example.com',
  fullName: 'John Doe'
});

// When user logs out
rehearsals.reset();
This enables you to:
  • Track user behavior across multiple sessions and devices
  • See what users did before they logged in
  • Build comprehensive user profiles with behavioral insights
Visit the Identity API documentation for complete details, best practices, and framework-specific examples.

Cross-Domain Tracking

Set to share session IDs across subdomains (e.g., .example.com)When set, sessions will persist as users navigate across all subdomains.

Example: Cross-Subdomain Tracking

If you have multiple subdomains like app.yoursite.com, blog.yoursite.com, and shop.yoursite.com, you can track users across all of them:
<script>
  window.deepPredictionSettings = {
    apiKey: 'dp_proj_xxxxx',
    organizationId: 'dp_org_xxxxx',
    cookieDomain: '.yoursite.com'  // Sessions persist across all *.yoursite.com
  };
</script>
<script src="https://app.runrehearsals.com/recorder.js" async></script>
The cookieDomain must start with a dot (.) to work across subdomains.

Configuration Example

Here’s a complete configuration example with all available options:
<script>
  window.deepPredictionSettings = {
    apiKey: 'dp_proj_xxxxx',
    organizationId: 'dp_org_xxxxx'
  };
</script>
<script src="https://app.runrehearsals.com/recorder.js" async></script>

Content Security Policy (CSP)

If your site uses Content Security Policy, add these directives:
script-src 'self' https://app.runrehearsals.com https://cdn.jsdelivr.net;
connect-src 'self' https://us-central1-deep-prediction-e967e.cloudfunctions.net;

Example CSP Header

<meta http-equiv="Content-Security-Policy" 
      content="
        default-src 'self';
        script-src 'self' https://app.runrehearsals.com https://cdn.jsdelivr.net;
        connect-src 'self' https://us-central1-deep-prediction-e967e.cloudfunctions.net;
      ">

Next Steps