### start()
Source: https://docs.openreplay.com/en/android-sdk/methods
Starts recording a session.
```APIDOC
## start()
### Description
Starts recording a session.
### Method
start()
### Parameters
None documented.
### Returns
None documented.
```
--------------------------------
### Retrieve live sessions via GET
Source: https://docs.openreplay.com/en/api/assist
Example request to fetch live sessions for a project, optionally filtered by userId.
```bash
curl -X GET \
'{BASE_URL}/public/aYYaFHiagqdXKEmVlmvJ/assist/sessions?userId=mickael@openreplay.com' \
-H 'Authorization: Bearer {YOUR_ORGANIZATION_API_KEY}'
```
--------------------------------
### Install OpenReplay CLI and deploy
Source: https://docs.openreplay.com/en/deployment/deploy-aws
Download the OpenReplay CLI tool and run the installation command by specifying your domain name.
```bash
sudo wget https://raw.githubusercontent.com/openreplay/openreplay/main/scripts/helmcharts/openreplay-cli -O /bin/openreplay
sudo chmod +x /bin/openreplay
openreplay -i DOMAIN_NAME
```
--------------------------------
### Initialize OpenReplay tracker in Svelte with onMount
Source: https://docs.openreplay.com/en/sdk/using-or/svelte
Use onMount to ensure the tracker is imported and initialized only on the client side. This example demonstrates both the singleton and class-based approaches for configuring and starting the tracker.
```svelte
```
--------------------------------
### Install Postgres client
Source: https://docs.openreplay.com/en/configuration/external-db
Install the necessary client tools on the OpenReplay instance to interact with the external database.
```bash
sudo apt install postgresql-client
```
--------------------------------
### coldStart()
Source: https://docs.openreplay.com/en/sdk/methods
Starts buffering messages (refreshing buffer) with the possibility to call start() to enable session recording and send the buffer content.
```APIDOC
## coldStart()
### Description
Starts buffering messages (refreshing buffer) with the possibility to call start() to enable session recording and send the buffer content.
### Method
coldStart()
### Parameters
None documented.
### Response
No documented response.
```
--------------------------------
### onCallStart callback example
Source: https://docs.openreplay.com/en/plugins/assist
Fired when a call (webRTC) starts. Receives agent details. Can return onCallEnd, called when call ends. May fire multiple times on unstable connections.
```javascript
onCallStart: () => {
console.log("Call started")
const onCallEnd = () => console.log("Call ended")
return onCallEnd
}
```
--------------------------------
### Install OpenReplay via script
Source: https://docs.openreplay.com/en/deployment/deploy-docker
Execute the OpenReplay installation script using curl to set up the stack on the server.
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/openreplay/openreplay/main/scripts/docker-compose/docker-install.sh)"
```
--------------------------------
### Install Pinia Plugin
Source: https://docs.openreplay.com/en/plugins/pinia
Use npm to install the @openreplay/tracker-vuex package.
```bash
npm i @openreplay/tracker-vuex
```
--------------------------------
### Install Profiler Plugin
Source: https://docs.openreplay.com/en/plugins/profiler
Install the profiler package using npm.
```bash
npm i @openreplay/tracker-profiler
```
--------------------------------
### Integrate OpenReplay tracker in a React application
Source: https://docs.openreplay.com/en/tutorials/build-plugins
This example demonstrates how to instantiate the OpenReplay tracker, register a plugin using the use method, and start the tracker within a React useEffect hook.
```javascript
import logo from './logo.svg';
import './App.css';
import tracker from 'openreplay-tracker'
import jqueryTracker from 'tracker-jquery'
import { useEffect } from 'react';
import $ from 'jquery'
const t = new tracker({
__DISABLE_SECURE_MODE: true, //only if you're testing locally
ingestPoint: "openreplay./ingest",
projectKey: "",
})
function App() {
useEffect(()=> {
t.use(jqueryTracker($))
t.start()
async function doGet() {
let resp = await $.get({
url: "http://localhost:3000"
})
console.log(resp)
}
doGet()
}, [])
return (
);
}
export default App;
```
--------------------------------
### start(startOpts?: Partial): Promise
Source: https://docs.openreplay.com/en/sdk/methods/start
Starts the OpenReplay tracker to begin session recording. Accepts optional configuration options and returns a promise with session information or failure reason.
```APIDOC
## start(startOpts?: Partial): Promise
### Description
Starts the tracker, which begins recording the session. Accepts an optional configuration object to customize recording behavior.
### Method
start
### Signature
start(startOpts?: Partial): Promise
### Parameters
#### Optional Parameters (startOpts)
- **userID** (string) - Optional - Manually set the user ID to track across sessions.
- **metadata** (Record) - Optional - Manually set metadata values.
- **forceNew** (boolean) - Optional - Force a new session after page refresh. Default is false.
- **sessionToken** (string) - Optional - Used in some integrations.
- **assistOnly** (boolean) - Optional - Launches tracker in assist-only mode, skipping session data to backend (EE edition feature).
- **startCallback** (function) - Optional - Callback triggered when the tracker starts or fails to start. Returns success or failure information.
### Return Value
Returns a promise that resolves to a StartPromiseReturn object.
#### Success Case
- **sessionID** (string) - The ID of the started session.
- **sessionToken** (string) - The token of the session.
- **userUUID** (string) - A unique identifier for the user.
#### Failure Case
- **reason** (string) - Reason for failure.
- **success** (boolean) - Set to false.
### Type Definitions
```
interface OnStartInfo {
sessionID: string;
sessionToken: string;
userUUID: string;
}
const SuccessfulStart = (body: OnStartInfo): SuccessfulStart => ({
...body,
success: true,
});
const UnsuccessfulStart = (reason: string): UnsuccessfulStart => ({
reason,
success: false,
});
export type StartPromiseReturn = SuccessfulStart | UnsuccessfulStart;
```
```
--------------------------------
### Install @openreplay/tracker-assist via npm
Source: https://docs.openreplay.com/en/plugins/assist
Install the OpenReplay Assist plugin package using npm.
```bash
npm i @openreplay/tracker-assist
```
--------------------------------
### Backup current installation
Source: https://docs.openreplay.com/en/deployment/deprecated-versions
Back up the existing v1.3.6 installation folder before upgrading.
```bash
mv openreplay openreplay_v1.3.6
```
--------------------------------
### Install OpenReplay React Native SDK
Source: https://docs.openreplay.com/en/rn-sdk/init
Use this command to install the tracker and SDK dependencies.
```bash
npm i @openreplay/react-native
```
--------------------------------
### assist.start()
Source: https://docs.openreplay.com/en/plugins/assist
Starts or restarts the assist runtime. It is a no-op if the tracker is not active yet, and in Autostart.Continuation mode it persists a flag in sessionStorage to auto-continue across page reloads. An explicit start() also supersedes any ignoreAnonymous postponement.
```APIDOC
## assist.start()
### Description
Starts or restarts the assist runtime. It is a no-op if the tracker itself isn't active yet (assist will start together with the tracker). In Autostart.Continuation mode, it persists a flag in sessionStorage so assist auto-continues across page reloads. An explicit start() also supersedes any ignoreAnonymous postponement.
### Method
start
### Parameters
None
### Return Value
undefined
### Example
```javascript
const assist = tracker.use(trackerAssist(options));
assist.start();
```
```
--------------------------------
### Install MobX plugin
Source: https://docs.openreplay.com/en/plugins/mobx
Install the OpenReplay MobX tracker package via npm.
```bash
npm i @openreplay/tracker-mobx
```
--------------------------------
### Install via Cocoapods
Source: https://docs.openreplay.com/en/ios-sdk/init
Add this line to your Podfile to install the OpenReplay tracker.
```ruby
pod 'OpenReplay', '~> 1.0.17'
```
--------------------------------
### Install OpenReplay tracker via NPM
Source: https://docs.openreplay.com/en/deployment/setup-or
Install the required OpenReplay tracker package using npm.
```bash
npm i @openreplay/tracker
```
--------------------------------
### Install Docker
Source: https://docs.openreplay.com/en/deployment/deploy-source
Commands to update the package list, install Docker, and grant the current user permissions to the Docker socket.
```bash
sudo apt update
sudo apt install docker.io -y
user=`whoami`
sudo chown $user /var/run/docker.sock
```
--------------------------------
### Configure Service Image in vars.yaml
Source: https://docs.openreplay.com/en/deployment/deploy-source
Example configuration for a service image within the vars.yaml file, using the alerts service as an example.
```yaml
alerts:
image:
repository: rg.fr-par.scw.cloud/foss/alerts
pullPolicy: Always
tag: "v1.4.2"
imagePullSecrets:
- name: my-registry-secret
```
--------------------------------
### Get user response example
Source: https://docs.openreplay.com/en/api/users
The JSON response body returned when successfully fetching user data.
```json
{
"data": {
"$user_id": "mickael@openreplay.com",
"$email": "mickael@openreplay.com",
"$name": "Mickael",
"$first_name": "Mickael",
"$last_name": "",
"$phone": "",
"$avatar": "",
"$created_at": 1623440822825,
"distinct_ids": ["15bd70f6-aedf-4544-8ae6-57eb66398e94"],
"$country": "FR",
"$state": "",
"$city": "",
"$first_event_at": 1623440822825,
"$last_seen": 1623689478617
}
}
```
--------------------------------
### Call patchNetwork() to start network interception
Source: https://docs.openreplay.com/en/flutter-sdk/network
Call patchNetwork() once after starting the tracker. It installs an HttpOverrides, chaining to whatever was installed before, and captures every dart:io HttpClient call, covering package:http's IOClient and Dio's default adapter. It is idempotent; unpatchNetwork() restores the previous overrides. The tracker's own ingest traffic is never captured.
```dart
import 'package:openreplay/openreplay.dart';
OpenReplay.instance.patchNetwork();
```
--------------------------------
### OpenReplay.instance.start
Source: https://docs.openreplay.com/en/flutter-sdk/methods/start
Starts the tracker and begins session recording. Must be called with a project key and optional options and server URL.
```APIDOC
## OpenReplay.instance.start
### Description
Starts the tracker, initiating session recording. The app must be wrapped in OpenReplayWidget for screen recording.
### Signature
```dart
Future OpenReplay.instance.start({
required String projectKey,
OROptions options = OROptions.defaults,
String? serverUrl,
})
```
### Parameters
- **projectKey** (String) - Required - Found in your OpenReplay dashboard under 'Preferences > Projects'.
- **options** (OROptions) - Optional - What the tracker captures, see below.
- **serverUrl** (String?) - Optional - Ingest endpoint for self-hosted deployments. Omit it on OpenReplay Cloud.
### Initialization Options
- **crashes** (bool) - Captures Dart errors.
- **analytics** (bool) - Captures touches, swipes, screens and inputs.
- **performances** (bool) - Captures CPU, memory, battery and thermal state.
- **logs** (bool) - Captures debugPrint output.
- **screen** (bool) - Enables frame capture.
- **screenshotBatchSize** (ScreenshotBatchSize) - Frames per upload: low (10), normal (20), high (30). Default: normal.
- **targetLongEdge** (int) - Longest edge of a captured frame, in pixels. Default: 720.
- **dedupeFrames** (bool) - Skips frames identical to the previous one.
- **maskPlatformViews** (bool) - Covers WebViews, maps and camera previews with a placeholder.
- **wifiOnly** (bool) - Reserved; not yet enforced.
- **debugLogs** (bool) / **debugImages** (bool) - The SDK's own debug output. Default: false.
Default: all booleans true except debugLogs and debugImages. Frame rate and image quality come from project settings.
### Usage Notes
- start() is safe to call before the first frame; capture begins once the widget has laid out.
```
--------------------------------
### Configure Redux middleware for SSR
Source: https://docs.openreplay.com/en/plugins/redux
Setup the Redux tracker for Server-Side-Rendered applications, ensuring the tracker starts only in the browser environment.
```javascript
'use client'
import { applyMiddleware, createStore } from 'redux';
import trackerRedux from '@openreplay/tracker-redux/cjs';
import { tracker } from '@openreplay/tracker';
tracker.configure({
projectKey: 'YOUR_PROJECT_KEY',
ingestPoint: "https://openreplay.mydomain.com/ingest", // when dealing with the self-hosted version of OpenReplay
});
const openReplayMiddleware = tracker.use(trackerRedux()); // check list of available options below
const store = createStore( // You can define/use it anywhere in response handlers
reducer,
applyMiddleware(openReplayMiddleware)
);
//...
function MyApp() {
useEffect(() => { // use componentDidMount in case of React Class Component
tracker.start();
}, []);
//... Use store here
}
```
--------------------------------
### SSR usage with meta-reducer
Source: https://docs.openreplay.com/en/plugins/ngrx
Usage example for Server-Side-Rendered applications. Uses the CJS builds of the tracker and plugin, and ensures tracker.start() is called once the app starts.
```typescript
import { StoreModule } from '@ngrx/store';
import OpenReplay from '@openreplay/tracker/cjs';
import trackerNgRx from '@openreplay/tracker-ngrx/cjs';
//...
const tracker = new OpenReplay({
projectKey: PROJECT_KEY
});
const metaReducers = [tracker.use(trackerNgRx())]; // check list of available options below
//...
@NgModule({
imports: [StoreModule.forRoot({}, { metaReducers })]
})
export class AppModule {}
}
```
--------------------------------
### Initialize OpenReplay Tracker
Source: https://docs.openreplay.com/en/rn-sdk/init
Add this code to your root file to start the session. Replace 'yourProjectKey' with your actual project key and provide the appropriate ingest URL.
```javascript
import Openreplay from '@openreplay/react-native';
// ...
useEffect(() => {
Openreplay.tracker.startSession(
'yourProjectKey',
options, // explained below, set {} if empty
'https://local.openreplay.instance/ingest' // if you're using our Serverless/SaaS plan then 'https://api.openreplay.com/ingest'
);
}, [])
```
--------------------------------
### patchNetwork()
Source: https://docs.openreplay.com/en/flutter-sdk/network
Installs an HttpOverrides to capture all dart:io HttpClient calls, including those from package:http and Dio. Call once after starting the tracker. It is idempotent and can be reverted with unpatchNetwork().
```APIDOC
## patchNetwork()
### Description
Installs an HttpOverrides to capture all dart:io HttpClient calls, including those from package:http and Dio. Call once after starting the tracker. It is idempotent and can be reverted with unpatchNetwork().
### Method
patchNetwork()
### Parameters
- **options** (ORNetworkOptions) - Optional - Configuration for network interception.
### Example
```dart
import 'package:openreplay/openreplay.dart';
OpenReplay.instance.patchNetwork();
```
### Notes
- The tracker's own ingest traffic is never captured.
- Use unpatchNetwork() to restore previous overrides.
```
--------------------------------
### onRemoteControlStart callback example
Source: https://docs.openreplay.com/en/plugins/assist
Fired when a remote control session starts. Receives agent details. Can return onRemoteControlEnd, called when remote control permissions are revoked.
```javascript
onRemoteControlStart: () => {
console.log("Remote control started")
const onControlEnd = () => console.log("Remote control ended")
return onControlEnd
}
```
--------------------------------
### OpenReplay.instance.patchNetwork([ORNetworkOptions options = const ORNetworkOptions()])
Source: https://docs.openreplay.com/en/flutter-sdk/methods/patch-network
Starts capturing dart:io HTTP traffic by installing an HttpOverrides. This method is idempotent and chains to any already present overrides.
```APIDOC
## OpenReplay.instance.patchNetwork([ORNetworkOptions options = const ORNetworkOptions()])
### Description
Starts capturing `dart:io` HTTP traffic. This installs an `HttpOverrides`, chaining to any already present, so it covers `HttpClient` directly as well as `package:http`'s `IOClient` and Dio's default adapter. The method is idempotent.
### Method
patchNetwork
### Signature
```
OpenReplay.instance.patchNetwork([ORNetworkOptions options = const ORNetworkOptions()])
```
### Parameters
#### Optional Parameters
- **options** (ORNetworkOptions) - Optional - Configuration options for network capture, including `capturePayload` and `sanitizer`.
### Example
```
OpenReplay.instance.patchNetwork(ORNetworkOptions(
capturePayload: true,
sanitizer: (record) {
record.url = record.url.replaceAll(RegExp(r'token=[^&]+'), 'token=***');
return record; // return null to drop the call entirely
},
));
```
### Notes
- A custom Dio adapter bypasses `HttpOverrides`. In that case add your own interceptor and call `OpenReplay.instance.networkRequest(...)` from it.
- See network options for every field of `ORNetworkOptions`.
```
--------------------------------
### ORTracker.shared.start(projectKey:options:)
Source: https://docs.openreplay.com/en/ios-sdk/methods/start
Starts the OpenReplay tracker with the given project key and options. This begins session recording.
```APIDOC
## ORTracker.shared.start(projectKey: String, options: OROptions)
### Description
Starts the tracker, which begins recording the session.
### Signature
ORTracker.shared.start(projectKey: String, options: OROptions)
### Parameters
- **projectKey** (String) - Required - The project key for the OpenReplay project.
- **options** (OROptions) - Required - Initialization options for the tracker.
### Initialization Options
- **crashes** (Bool) - Enables crashlytics.
- **analytics** (Bool) - Enables analytics for views.
- **performances** (Bool) - Enables performance listener.
- **logs** (Bool) - Enables logs listener.
- **screen** (Bool) - Enables screen recorder.
- **wifiOnly** (Bool) - Forces tracker to start only if user has a Wi-Fi connection.
Default: all `true`
```
--------------------------------
### OpenReplay.start(applicationContext: Context, projectKey: String, options: OROptions)
Source: https://docs.openreplay.com/en/android-sdk/methods/start
Starts the OpenReplay tracker to begin recording the session. Accepts the application context, project key, and an options object to configure tracking features.
```APIDOC
## OpenReplay.start(applicationContext: Context, projectKey: String, options: OROptions)
### Description
Starts the OpenReplay tracker, which begins recording the session. This method initializes the tracker with the provided application context, project key, and options.
### Method
start
### Signature
OpenReplay.start(applicationContext: Context, projectKey: String, options: OROptions)
### Parameters
- **applicationContext** (Context) - Required - The application context.
- **projectKey** (String) - Required - The project key for the OpenReplay project.
- **options** (OROptions) - Required - Initialization options to configure the tracker.
### Initialization Options
- **crashes** (Bool) - Optional - Enables crashlytics. Default: true
- **analytics** (Bool) - Optional - Enables analytics for views. Default: true
- **performances** (Bool) - Optional - Enables performance listener. Default: true
- **logs** (Bool) - Optional - Enables logs listener. Default: true
- **screen** (Bool) - Optional - Enables screen recorder. Default: true
- **wifiOnly** (Bool) - Optional - Forces tracker to start only if user has a wifi connection. Default: true
### Response
No return value is documented.
```
--------------------------------
### Propagate openReplaySession.id in Frontend API Requests
Source: https://docs.openreplay.com/en/integrations/elastic
This JavaScript example demonstrates how to initialize the OpenReplay tracker, wait for it to start, and include the session ID in the headers of a fetch request.
```javascript
// JavaScript Example for for Single Page Applications (SPA):
// Import OpenReplay
import { tracker } from '@openreplay/tracker';
// Initialize the tracker
tracker.configure({
projectKey: 'YOUR_PROJECT_KEY',
ingestPoint: "https://openreplay.mydomain.com/ingest", // when dealing with the self-hosted version of OpenReplay
});
// Start the tracker and wait for it to resolve
tracker.start().then(() => {
// Get the session ID after the tracker has started
const sessionId = tracker.getSessionID();
const headers = {
'Content-Type': 'application/json',
};
if (sessionId) {
headers['openReplaySession.id'] = sessionId;
}
// Make the API request
fetch('https://www.your-backend.com/api/endpoint', {
method: 'GET', // or 'POST', 'PUT', etc.
headers,
// ...other options
})
.then(response => {
// Handle response
})
.catch(error => {
// Handle error
});
});
```
--------------------------------
### SSH into the instance
Source: https://docs.openreplay.com/en/deployment/deploy-docker
Configure the SSH key path and instance IP, set the correct permissions for the key, and connect to the Ubuntu instance.
```bash
SSH_KEY=~/Downloads/openreplay-key.pem #! wherever you've saved the SSH key
INSTANCE_IP=REPLACE_WITH_INSTANCE_PUBLIC_IP
chmod 400 $SSH_KEY
ssh -i $SSH_KEY ubuntu@$INSTANCE_IP
```
--------------------------------
### Initialize OpenReplay Tracker
Source: https://docs.openreplay.com/en/sdk/constructor
Basic example of initializing the OpenReplay tracker with configuration options.
```javascript
import OpenReplay from '@openreplay/tracker/cjs';
//...
const tracker = new OpenReplay({
projectKey: PROJECT_KEY,
ingestPoint: "https://openreplay.mydomain.com/ingest", // when dealing with the self-hosted version of OpenReplay
capturePerformance: true,
__DISABLE_SECURE_MODE: true // for local testing
});
```
--------------------------------
### Configure OpenReplay as a singleton in Gatsby
Source: https://docs.openreplay.com/en/sdk/using-or/gatsby
Use the tracker as a singleton instance to access it from anywhere in your application. This example demonstrates configuring the tracker and starting it within a React useEffect hook in index.tsx.
```javascript
import { tracker } from '@openreplay/tracker'
tracker.configure({
projectKey: 'YOUR_PROJECT_KEY',
ingestPoint: "https://openreplay.mydomain.com/ingest", // when dealing with the self-hosted version of OpenReplay
});
const Index = ({data, location }) => {
React.useEffect(() => {
tracker.start();
}, [])
//the rest of your code here...
}
```
--------------------------------
### OpenReplay.instance.coldStart and triggerRecording
Source: https://docs.openreplay.com/en/flutter-sdk/methods/start
Buffered start: coldStart records into a rolling buffer without creating a session, and triggerRecording promotes the buffer to a session.
```APIDOC
## OpenReplay.instance.coldStart
### Description
Starts recording into a rolling buffer without creating a session. Use this to capture preceding seconds before a trigger.
### Signature
```dart
Future OpenReplay.instance.coldStart({
required String projectKey,
})
```
### Parameters
- **projectKey** (String) - Required - Your OpenReplay project key.
## OpenReplay.instance.triggerRecording
### Description
Promotes the buffered recording to a session. Call this when something worth recording happens.
### Signature
```dart
Future OpenReplay.instance.triggerRecording({
String? condition,
})
```
### Parameters
- **condition** (String?) - Optional - A label or condition name for the trigger.
### Usage Example
```dart
await OpenReplay.instance.coldStart(projectKey: 'YOUR_PROJECT_KEY');
// later, when something worth recording happens
await OpenReplay.instance.triggerRecording(condition: 'checkout_error');
```
### Notes
Server-side condition evaluation is not yet available in the Flutter SDK; call triggerRecording() from your own code.
```
--------------------------------
### coldStart(startOpts?: Partial, isConditional?: boolean): Promise
Source: https://docs.openreplay.com/en/sdk/methods/cold-start
Begins buffering messages without starting the actual session. The buffer will keep the last 30 seconds of recorded events. You can activate the session by calling start() or via a conditional trigger.
```APIDOC
## coldStart(startOpts?: Partial, isConditional?: boolean): Promise
### Description
Begins buffering messages without starting the actual session. The buffer will keep the last 30 seconds of recorded events. You can activate the session by calling start() or via a conditional trigger.
### Method
SDK Method
### Signature
coldStart(startOpts?: Partial, isConditional?: boolean): Promise
### Parameters
- **startOpts** (Partial) - Optional - Customize different aspects of the recording.
- **userID** (string) - Optional - Used to manually set the userID to track it across sessions. This is a string value and it can be anything you want.
- **metadata** (Record) - Optional - Manually set the metadata values. Check the Metadata section to learn more about this.
- **forceNew** (boolean) - Optional - Used to force a new session after page refresh. By default it's set to false, so after a refresh the session is kept.
- **sessionHash** (string) - Optional - Used for sticky sessions. Useful if you have a multi-site application or if you have to redirect the user outside and then back into your site (like to a payment gateway).
- **isConditional** (boolean) - Optional - Decides if the tracker should wait for the trigger condition to be met before starting the session automatically.
### Return Value
This method does not return any value (Promise).
### Notes
Conditional recording is only supported in our Cloud and Enterprise Edition offerings.
```
--------------------------------
### Replace openreplay.js with openreplay-assist.js in JS snippet
Source: https://docs.openreplay.com/en/plugins/assist
For setups using the JS snippet, replace the script source with openreplay-assist.js. The example shows the updated tracking code with the assist script URL.
```html
```
--------------------------------
### onAgentConnect callback example
Source: https://docs.openreplay.com/en/plugins/assist
Fired when a live session starts. Receives agent details (email, name, query). Can return onAgentDisconnect, called when session disconnects. May fire multiple times on unstable connections.
```javascript
onAgentConnect = ({ email, name, query }) => {
console.log("Live session started")
const onAgentDisconnect = () => console.log("Live session stopped")
return onAgentDisconnect
}
```
--------------------------------
### Instantiating the tracker with Pinia plugin
Source: https://docs.openreplay.com/en/tutorials/pinia
Use the startTracker function to initialize the tracker and register the Pinia plugin.
```javascript
const {piniaPlugin} = startTracker({
projectKey: "",
plugins: [{
name: 'piniaPlugin',
fn: trackerVuex
}]
})
```
--------------------------------
### Buffered start with coldStart and triggerRecording
Source: https://docs.openreplay.com/en/flutter-sdk/methods/start
Use coldStart to begin recording into a rolling buffer without creating a session, then use triggerRecording to promote the buffer to a full session based on a custom condition.
```dart
await OpenReplay.instance.coldStart(projectKey: 'YOUR_PROJECT_KEY');
// later, when something worth recording happens
await OpenReplay.instance.triggerRecording(condition: 'checkout_error');
```
--------------------------------
### Intercept network request with NetworkListener
Source: https://docs.openreplay.com/en/rn-sdk/network
Use ORTracker's NetworkListener to intercept a URLSession data task. Start the listener with the request, then call finish(response:data:) in the completion handler. The example fetches Pokemon data from the PokeAPI.
```swift
import ORTracker
func fetchPokemonData(for name: String) {
let networkListener = NetworkListener()
let url = URL(string: "https://pokeapi.co/api/v2/pokemon/ditto")!
var request = URLRequest(url: url)
request.httpMethod = "GET" // This is the default, so it's optional in this case.
// Start the network listener with the request
networkListener.start(request: request)
// Create a data task
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("Error: \(error.localizedDescription)")
return
}
if let data = data {
do {
let json = try JSONSerialization.jsonObject(with: data, options: [])
print(json)
} catch {
print("Error deserializing JSON: \(error)")
}
}
networkListener.finish(response: response, data: data)
}
task.resume()
}
```
--------------------------------
### Get assist instance and call start/stop methods
Source: https://docs.openreplay.com/en/plugins/assist
Use tracker.use(trackerAssist(options)) to obtain the assist instance, then call stop() and start() to control assist at runtime. Note that tracker.use() returns undefined in environments where assist cannot load, such as without media devices support or inside an iframe, so guard the returned instance accordingly.
```javascript
const assist = tracker.use(trackerAssist(options));
assist.stop();
assist.start();
```
--------------------------------
### Install OpenReplay with Helm
Source: https://docs.openreplay.com/en/deployment/deploy-kubernetes
Deploy the databases and application components using Helm with the specified configuration file.
```bash
cd openreplay/scripts/helmcharts
helm upgrade --install databases ./databases -n db --create-namespace --wait -f ./vars.yaml --atomic
helm upgrade --install openreplay ./openreplay -n app --create-namespace --wait -f ./vars.yaml --atomic
```
--------------------------------
### Run OpenReplay CLI help
Source: https://docs.openreplay.com/en/deployment/openreplay-admin
Displays the help menu for the OpenReplay CLI to view available commands and options.
```bash
openreplay -h
```
--------------------------------
### OR.tracker.startSession(options)
Source: https://docs.openreplay.com/en/rn-sdk/methods/start
Starts the tracker to begin recording the session. Accepts an options object to enable or disable specific features.
```APIDOC
## OR.tracker.startSession(options)
### Description
Starts the tracker, which begins recording the session. By default, all options are enabled.
### Method
startSession
### Signature
```
import OR from '@openreplay/react-native'
OR.tracker.startSession(options)
```
### Parameters
#### options (Object) - Optional
An object containing initialization options. If not provided, all options default to `true`. Pass an empty object `{}` to disable all features.
- **crashes** (Bool) - Optional - Enables crashlytics.
- **analytics** (Bool) - Optional - Enables analytics tracking of marked views.
- **performances** (Bool) - Optional - Enables performance listener.
- **logs** (Bool) - Optional - Enables logs listener.
- **screen** (Bool) - Optional - Enables screen recorder.
### Example
```
import OR from '@openreplay/react-native'
OR.tracker.startSession({ crashes: true, analytics: false })
```
```
--------------------------------
### Install Redux dependencies
Source: https://docs.openreplay.com/en/tutorials/redux
Install the necessary Redux packages for the Next.js project.
```bash
npm i next-redux-wrapper redux react-redux redux-thunk redux-devtools-extension
```
--------------------------------
### Build the frontend Docker image
Source: https://docs.openreplay.com/en/deployment/deploy-source
Navigate to the frontend directory and execute the build script with the required environment variables.
```bash
cd openreplay/frontend
IMAGE_TAG= PUSH_IMAGE=1 DOCKER_REPO=myDockerHubID bash build.sh
```