core-outline 1.1.21 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,50 +1,81 @@
1
- # CoreOutline React Component
2
-
3
- A React component for integrating Core&Outline session recording and event tracking into your web application.
4
-
5
- ## Installation
6
-
7
- Install the package using npm:
8
-
9
- ```sh
10
- npm install core-outline
11
- ```
12
-
13
- or using yarn:
14
-
15
- ```sh
16
- yarn add core-outline
17
- ```
18
-
19
- ```sh
20
- import React from 'react';
21
- import CoreOutline from 'core-outline';
22
-
23
- function App() {
24
- return (
25
- <CoreOutline
26
- data_source_id={{ YOUR_DATA_SOURCE_ID }}
27
- data_source_secret={{ YOUR_DATA_SOURCE_SECRET }}>
28
- {/* Your app components */}
29
- </CoreOutline>
30
- );
31
- }
32
-
33
- export default App;
34
- ```
35
-
36
- To flag items clicked or purchased:
37
-
38
- ```sh
39
- import { flag_item_clicked, flag_item_purchased } from 'core-outline;
40
- ```
41
- To flag items clicked:
42
-
43
- ```sh
44
- flag_item_clicked('ITEM_ID');
45
- ```
46
- To flag items purchased:
47
-
48
- ```sh
49
- flag_item_purchased('ITEM_ID');
50
- ```
1
+ # Core&Outline React Component
2
+
3
+ A React component for automatically tracking user activity — page views, clicks, session duration, SPA navigation, and session recordings and streaming events to your Core&Outline analytics warehouse.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install core-outline
9
+ ```
10
+
11
+ ```sh
12
+ yarn add core-outline
13
+ ```
14
+
15
+ The response contains your `data_source_id`, `data_source_secret`, and `warehouse_id`. **The secret is shown once — store it securely.**
16
+
17
+ ```json
18
+ {
19
+ "data_source_id": "3f4a1c2d-...",
20
+ "data_source_secret": "aB3xK9mZqR...",
21
+ "warehouse_id": "cad1acc0-...",
22
+ "name": "My Website"
23
+ }
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ Wrap your app's root component with `<CoreOutline>`. All tracking is automatic from that point — no additional configuration is needed.
29
+
30
+ ```jsx
31
+ import React from 'react';
32
+ import { CoreOutline } from 'core-outline';
33
+
34
+ function App() {
35
+ return (
36
+ <CoreOutline
37
+ warehouse_id="cad1acc0-..."
38
+ data_source_id="3f4a1c2d-..."
39
+ data_source_secret="aB3xK9mZqR..."
40
+ >
41
+ {/* Your app */}
42
+ </CoreOutline>
43
+ );
44
+ }
45
+
46
+ export default App;
47
+ ```
48
+
49
+ ### Props
50
+
51
+ | Prop | Type | Required | Description |
52
+ |------|------|----------|-------------|
53
+ | `warehouse_id` | `string` | Yes | Your tenant warehouse UUID (returned from the SDK source creation call) |
54
+ | `data_source_id` | `string` | Yes | The UUID of your SDK data source |
55
+ | `data_source_secret` | `string` | Yes | The secret generated at data source creation |
56
+
57
+ ## What Gets Tracked Automatically
58
+
59
+ | Event | Description |
60
+ |-------|-------------|
61
+ | `session_start` | Fires when the component mounts; captures browser, OS, device type, UTM params, referrer |
62
+ | `pageview` | Fires on mount and on every SPA navigation (pushState / popstate) |
63
+ | `item_clicked` | Fires on every click; captures element tag, id, class, and inner text |
64
+ | `session_end` | Fires on tab close or visibility change; includes session duration and pageview count |
65
+ | Session recording | rrweb-powered DOM recording uploaded at session end |
66
+
67
+ All events include: `anonymous_id` (persistent across sessions), `session_id` (per tab), UTM parameters, page URL, page path, device type, OS, and browser name.
68
+
69
+ ## Manual Event Tracking
70
+
71
+ For commerce events, call the exported helpers from anywhere in your app — no props required.
72
+
73
+ ```js
74
+ import { flag_item_clicked, flag_item_purchased } from 'core-outline';
75
+
76
+ // Track a product click
77
+ flag_item_clicked('sku-123');
78
+
79
+ // Track a purchase (price is optional, maps to value_num in ClickHouse)
80
+ flag_item_purchased('sku-123', 49.99);
81
+ ```