core-outline 1.1.22 → 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,31 +1,44 @@
1
1
  # Core&Outline React Component
2
2
 
3
- A React component for integrating Core&Outline session recording and event tracking into your web application.
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
4
 
5
5
  ## Installation
6
6
 
7
- Install the package using npm:
8
-
9
7
  ```sh
10
8
  npm install core-outline
11
9
  ```
12
10
 
13
- or using yarn:
14
-
15
11
  ```sh
16
12
  yarn add core-outline
17
13
  ```
18
14
 
19
- ```sh
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
20
31
  import React from 'react';
21
- import CoreOutline from 'core-outline';
32
+ import { CoreOutline } from 'core-outline';
22
33
 
23
34
  function App() {
24
35
  return (
25
36
  <CoreOutline
26
- data_source_id={{ YOUR_DATA_SOURCE_ID }}
27
- data_source_secret={{ YOUR_DATA_SOURCE_SECRET }}>
28
- {/* Your app components */}
37
+ warehouse_id="cad1acc0-..."
38
+ data_source_id="3f4a1c2d-..."
39
+ data_source_secret="aB3xK9mZqR..."
40
+ >
41
+ {/* Your app */}
29
42
  </CoreOutline>
30
43
  );
31
44
  }
@@ -33,20 +46,36 @@ function App() {
33
46
  export default App;
34
47
  ```
35
48
 
36
- To flag items clicked or purchased:
49
+ ### Props
37
50
 
38
- ```sh
39
- import { flag_item_clicked, flag_item_purchased } from 'core-outline;
40
- ```
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 |
41
56
 
42
- To flag items clicked:
57
+ ## What Gets Tracked Automatically
43
58
 
44
- ```sh
45
- flag_item_clicked('ITEM_ID');
46
- ```
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 |
47
66
 
48
- To flag items purchased:
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.
49
68
 
50
- ```sh
51
- flag_item_purchased('ITEM_ID');
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);
52
81
  ```