tracker doc fix

This commit is contained in:
nick-delirium 2024-07-31 09:40:54 +02:00
parent 4246634a7d
commit 42eb4b5040
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
17 changed files with 67 additions and 34 deletions

View file

@ -17,7 +17,9 @@ import trackerAssist from '@openreplay/tracker-assist';
const tracker = new OpenReplay({
projectKey: '${props.projectKey}',
});
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
tracker.use(trackerAssist(options)); // check the list of available options below`}
</Highlight>
}
@ -31,8 +33,9 @@ const tracker = new OpenReplay({
const trackerAssist = tracker.use(trackerAssist(options)); // check the list of available options below
//...
function MyApp() {
useEffect(() => { // use componentDidMount in case of React Class Component
tracker.start();
useEffect(async () => { // use componentDidMount in case of React Class Component
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, [])
//...
}`}

View file

@ -37,7 +37,8 @@ import trackerGraphQL from '@openreplay/tracker-graphql';
const tracker = new OpenReplay({
projectKey: '${projectKey}'
});
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
//...
export const recordGraphQL = tracker.use(trackerGraphQL());`}
</Highlight>
@ -53,7 +54,8 @@ const tracker = new OpenReplay({
//...
function SomeFunctionalComponent() {
useEffect(() => { // or componentDidMount in case of Class approach
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, [])
}
//...

View file

@ -37,7 +37,9 @@ const tracker = new OpenReplay({
projectKey: '${projectKey}'
});
tracker.use(trackerMobX(<options>)); // check list of available options below
tracker.start();`}
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... );
`}
</Highlight>
}
second={
@ -52,7 +54,8 @@ tracker.use(trackerMobX(<options>)); // check list of available options below
//...
function SomeFunctionalComponent() {
useEffect(() => { // or componentDidMount in case of Class approach
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, [])
}`}
</Highlight>

View file

@ -35,7 +35,8 @@ import trackerNgRx from '@openreplay/tracker-ngrx';
const tracker = new OpenReplay({
projectKey: '${projectKey}'
});
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
//...
const metaReducers = [tracker.use(trackerNgRx(<options>))]; // check list of available options below
//...
@ -58,7 +59,8 @@ const tracker = new OpenReplay({
//...
function SomeFunctionalComponent() {
useEffect(() => { // or componentDidMount in case of Class approach
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, [])
//...
const metaReducers = [tracker.use(trackerNgRx(<options>))]; // check list of available options below

View file

@ -36,7 +36,8 @@ import trackerVuex from '@openreplay/tracker-vuex';
const tracker = new OpenReplay({
projectKey: '${projectKey}'
});
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
//...
const examplePiniaStore = useExamplePiniaStore()
// check list of available options below
@ -65,7 +66,8 @@ const tracker = new OpenReplay({
//...
// start tracker when the app is mounted
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
//...
const examplePiniaStore = useExamplePiniaStore()

View file

@ -33,7 +33,8 @@ import trackerProfiler from '@openreplay/tracker-profiler';
const tracker = new OpenReplay({
projectKey: '${projectKey}'
});
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
//...
export const profiler = tracker.use(trackerProfiler());
//...
@ -53,7 +54,8 @@ const tracker = new OpenReplay({
//...
function SomeFunctionalComponent() {
useEffect(() => { // or componentDidMount in case of Class approach
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, [])
//...
export const profiler = tracker.use(trackerProfiler());

View file

@ -33,7 +33,8 @@ import trackerRedux from '@openreplay/tracker-redux';
const tracker = new OpenReplay({
projectKey: '${projectKey}'
});
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
//...
const store = createStore(
reducer,
@ -53,7 +54,8 @@ const tracker = new OpenReplay({
//...
function SomeFunctionalComponent() {
useEffect(() => { // or componentDidMount in case of Class approach
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, [])
//...
const store = createStore(

View file

@ -36,7 +36,8 @@ import trackerVuex from '@openreplay/tracker-vuex';
const tracker = new OpenReplay({
projectKey: '${projectKey}'
});
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
//...
const store = new Vuex.Store({
//...
@ -56,7 +57,8 @@ const tracker = new OpenReplay({
//...
function SomeFunctionalComponent() {
useEffect(() => { // or componentDidMount in case of Class approach
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, [])
//...
const store = new Vuex.Store({

View file

@ -14,7 +14,8 @@ const tracker = new Tracker({
projectKey: "PROJECT_KEY",
ingestPoint: "https://${window.location.hostname}/ingest",
});
tracker.start();`;
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )`;
const usageCodeSST = `import Tracker from '@openreplay/tracker/cjs';
const tracker = new Tracker({
@ -24,7 +25,8 @@ const tracker = new Tracker({
function MyApp() {
useEffect(() => { // use componentDidMount in case of React Class Component
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, []);
//...

View file

@ -11,7 +11,9 @@ const tracker = new Tracker({
projectKey: "PROJECT_KEY",
ingestPoint: "https://${window.location.hostname}/ingest",
});
tracker.start();`
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )`
const usageCodeSST = `import Tracker from '@openreplay/tracker/cjs';
const tracker = new Tracker({
@ -21,7 +23,8 @@ const tracker = new Tracker({
function MyApp() {
useEffect(() => { // use componentDidMount in case of React Class Component
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, []);
//...

View file

@ -33,7 +33,8 @@ const tracker = new Tracker({
});
tracker.use(trackerAssist(options)); // check the list of available options below
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
```
@ -53,7 +54,8 @@ tracker.use(trackerAssist(options)); // check the list of available options belo
//...
function MyApp() {
useEffect(() => { // use componentDidMount in case of React Class Component
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
}, [])
//...
}

View file

@ -22,7 +22,8 @@ import trackerAxios from '@openreplay/tracker-axios';
const tracker = new Tracker({
projectKey: YOUR_PROJECT_KEY,
});
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
tracker.use(trackerAxios({ /* options here*/ }));
```

View file

@ -26,7 +26,8 @@ const tracker = new OpenReplay({
});
const fetch = tracker.use(trackerFetch(options)); // check list of available options below
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
fetch('https://myapi.com/').then(response => console.log(response.json()));
```
@ -47,7 +48,8 @@ const fetch = tracker.use(trackerFetch(options)); // check list of available opt
//...
function MyApp() {
useEffect(() => { // use componentDidMount in case of React Class Component
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
fetch('https://myapi.com/').then(response => console.log(response.json()));
}, [])

View file

@ -21,7 +21,8 @@ import trackerProfiler from '@openreplay/tracker-profiler';
const tracker = new Tracker({
projectKey: YOUR_PROJECT_KEY,
});
tracker.start();
// .start() returns a promise
tracker.start().then(sessionData => ... ).catch(e => ... )
export const profiler = tracker.plugin(trackerProfiler());

View file

@ -1,3 +1,7 @@
# 14.0.4
- remove reject from start
# 14.0.3
- send integer instead of float for normalizedX/Y coords (basically moving from 0-100 to 0-10000 range)

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker",
"description": "The OpenReplay tracker main package",
"version": "14.0.3",
"version": "14.0.4",
"keywords": [
"logging",
"replay"

View file

@ -1221,18 +1221,18 @@ export default class App {
condition: conditionName,
assistOnly: startOpts.assistOnly ?? this.socketMode,
width: window.screen.width,
height: window.screen.height
height: window.screen.height,
}),
})
if (r.status !== 200) {
const error = await r.text()
const reason = error === CANCELED ? CANCELED : `Server error: ${r.status}. ${error}`
return Promise.reject(reason)
return UnsuccessfulStart(reason)
}
if (!this.worker) {
const reason = 'no worker found after start request (this might not happen)'
const reason = 'no worker found after start request (this should not happen in real world)'
this.signalError(reason, [])
return Promise.reject(reason)
return UnsuccessfulStart(reason)
}
const {
token,
@ -1265,7 +1265,7 @@ export default class App {
) {
const reason = `Incorrect server response: ${JSON.stringify(r)}`
this.signalError(reason, [])
return Promise.reject(reason)
return UnsuccessfulStart(reason)
}
this.delay = delay