@walkeros/web-source-browser 0.0.0-next-20251219153324
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 +142 -0
- package/dist/dev.d.mts +59 -0
- package/dist/dev.d.ts +59 -0
- package/dist/dev.js +1 -0
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +1 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.mts +157 -0
- package/dist/index.d.ts +157 -0
- package/dist/index.es5.js +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<p align="left">
|
|
2
|
+
<a href="https://www.walkeros.io">
|
|
3
|
+
<img title="elbwalker" src='https://www.walkeros.io/img/elbwalker_logo.png' width="256px"/>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
# Browser DOM Source for walkerOS
|
|
8
|
+
|
|
9
|
+
[Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/sources/browser)
|
|
10
|
+
• [NPM Package](https://www.npmjs.com/package/@walkeros/web-source-browser)
|
|
11
|
+
|
|
12
|
+
The Browser Source is walkerOS's primary web tracking solution that you can use
|
|
13
|
+
to capture user interactions directly from the browsers DOM.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @walkeros/web-source-browser
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { sourceBrowser } from '@walkeros/web-source-browser';
|
|
23
|
+
await startFlow({ sources: { browser: { code: sourceBrowser } } });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## What It Does
|
|
27
|
+
|
|
28
|
+
The Browser Source transforms your website into a comprehensive tracking
|
|
29
|
+
environment by:
|
|
30
|
+
|
|
31
|
+
- **Data attribute reading**: Extracts custom tracking data from HTML `data-elb`
|
|
32
|
+
attributes
|
|
33
|
+
- **Session management**: Detects and handles user sessions automatically
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### With npm
|
|
38
|
+
|
|
39
|
+
Install the source via npm:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install @walkeros/web-source-browser
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Setup in your project:
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import { startFlow } from '@walkeros/collector';
|
|
49
|
+
import { sourceBrowser } from '@walkeros/web-source-browser';
|
|
50
|
+
|
|
51
|
+
const { collector } = await startFlow({
|
|
52
|
+
sources: {
|
|
53
|
+
browser: {
|
|
54
|
+
code: sourceBrowser,
|
|
55
|
+
config: {
|
|
56
|
+
settings: {
|
|
57
|
+
pageview: true,
|
|
58
|
+
session: true,
|
|
59
|
+
elb: 'elb', // Browser source will set window.elb automatically
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### With a script tag
|
|
68
|
+
|
|
69
|
+
Load the source via dynamic import:
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<script>
|
|
73
|
+
// Load the collector and source
|
|
74
|
+
const { startFlow } = await import(
|
|
75
|
+
'https://cdn.jsdelivr.net/npm/@walkeros/collector/dist/index.mjs'
|
|
76
|
+
);
|
|
77
|
+
const { sourceBrowser } = await import(
|
|
78
|
+
'https://cdn.jsdelivr.net/npm/@walkeros/web-source-browser/dist/index.mjs'
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const { collector, elb } = await startFlow({
|
|
82
|
+
sources: {
|
|
83
|
+
browser: {
|
|
84
|
+
code: sourceBrowser,
|
|
85
|
+
config: {
|
|
86
|
+
settings: {
|
|
87
|
+
prefix: 'data-elb',
|
|
88
|
+
pageview: true,
|
|
89
|
+
session: true,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
</script>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Configuration reference
|
|
99
|
+
|
|
100
|
+
| Name | Type | Description | Required | Example |
|
|
101
|
+
| ---------- | -------------------------------- | ------------------------------------------------ | -------- | -------------------------------- |
|
|
102
|
+
| `prefix` | `string` | Prefix for data attributes used in DOM tracking | No | `'data-elb'` |
|
|
103
|
+
| `scope` | `Element \| Document` | DOM scope for event tracking (default: document) | No | `document.querySelector("#app")` |
|
|
104
|
+
| `pageview` | `boolean` | Enable automatic pageview tracking | No | `true` |
|
|
105
|
+
| `session` | `boolean` | Enable session tracking and management | No | `true` |
|
|
106
|
+
| `elb` | `string` | Custom name for the global elb function | No | `'elb'` |
|
|
107
|
+
| `name` | `string` | Custom name for the browser source instance | No | `'mySource'` |
|
|
108
|
+
| `elbLayer` | `boolean \| string \| Elb.Layer` | Enable elbLayer for async command queuing | No | `true` |
|
|
109
|
+
|
|
110
|
+
### elb
|
|
111
|
+
|
|
112
|
+
> **Two Different elb Functions**
|
|
113
|
+
>
|
|
114
|
+
> The collector provides **two different elb functions**:
|
|
115
|
+
>
|
|
116
|
+
> 1. **Collector elb** (`elb` from `startFlow`): Basic event tracking that
|
|
117
|
+
> works with all sources and destinations
|
|
118
|
+
> 2. **Browser Source elb** (`collector.sources.browser.elb`): Enhanced
|
|
119
|
+
> function with browser-specific features
|
|
120
|
+
>
|
|
121
|
+
> **Browser Source elb adds:**
|
|
122
|
+
>
|
|
123
|
+
> - **DOM Commands**: `walker init` for asynchronous loading of DOM elements
|
|
124
|
+
> - **Flexible Arguments**: Support for multiple argument patterns
|
|
125
|
+
> - **elbLayer Integration**: Automatic processing of queued commands
|
|
126
|
+
> - **Element parameters**: Support for element parameters in DOM commands
|
|
127
|
+
>
|
|
128
|
+
> Access the enhanced elb via `collector.sources.browser.elb`.
|
|
129
|
+
>
|
|
130
|
+
> See [Commands](https://www.walkeros.io/docs/sources/web/browser/commands) for
|
|
131
|
+
> full browser source API documentation.
|
|
132
|
+
|
|
133
|
+
## Contribute
|
|
134
|
+
|
|
135
|
+
Feel free to contribute by submitting an
|
|
136
|
+
[issue](https://github.com/elbwalker/walkerOS/issues), starting a
|
|
137
|
+
[discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
|
|
138
|
+
[contact](https://calendly.com/elb-alexander/30min).
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
This project is licensed under the MIT License.
|
package/dist/dev.d.mts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
|
+
import { z } from '@walkeros/core/dev';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Data attribute prefix
|
|
6
|
+
* Used for DOM event tracking
|
|
7
|
+
*/
|
|
8
|
+
declare const DataAttributePrefix: z.ZodString;
|
|
9
|
+
/**
|
|
10
|
+
* JavaScript variable name
|
|
11
|
+
* Used for global function names
|
|
12
|
+
*/
|
|
13
|
+
declare const JavaScriptVarName: z.ZodString;
|
|
14
|
+
/**
|
|
15
|
+
* DOM scope selector
|
|
16
|
+
* Note: Runtime type is Element | Document (non-serializable)
|
|
17
|
+
*/
|
|
18
|
+
declare const ScopeSelector: z.ZodOptional<z.ZodString>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Browser source settings schema
|
|
22
|
+
*/
|
|
23
|
+
declare const SettingsSchema: z.ZodObject<{
|
|
24
|
+
prefix: z.ZodDefault<z.ZodString>;
|
|
25
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
26
|
+
pageview: z.ZodDefault<z.ZodBoolean>;
|
|
27
|
+
session: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodAny]>>;
|
|
28
|
+
elb: z.ZodDefault<z.ZodString>;
|
|
29
|
+
name: z.ZodOptional<z.ZodString>;
|
|
30
|
+
elbLayer: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodAny]>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
type Settings = z.infer<typeof SettingsSchema>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Tagger configuration schema
|
|
36
|
+
* Used for automatic data attribute generation
|
|
37
|
+
*/
|
|
38
|
+
declare const TaggerSchema: z.ZodObject<{
|
|
39
|
+
prefix: z.ZodDefault<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
type TaggerConfig = z.infer<typeof TaggerSchema>;
|
|
42
|
+
|
|
43
|
+
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
44
|
+
declare const tagger: _walkeros_core_dev.JSONSchema;
|
|
45
|
+
|
|
46
|
+
declare const index_DataAttributePrefix: typeof DataAttributePrefix;
|
|
47
|
+
declare const index_JavaScriptVarName: typeof JavaScriptVarName;
|
|
48
|
+
declare const index_ScopeSelector: typeof ScopeSelector;
|
|
49
|
+
type index_Settings = Settings;
|
|
50
|
+
declare const index_SettingsSchema: typeof SettingsSchema;
|
|
51
|
+
type index_TaggerConfig = TaggerConfig;
|
|
52
|
+
declare const index_TaggerSchema: typeof TaggerSchema;
|
|
53
|
+
declare const index_settings: typeof settings;
|
|
54
|
+
declare const index_tagger: typeof tagger;
|
|
55
|
+
declare namespace index {
|
|
56
|
+
export { index_DataAttributePrefix as DataAttributePrefix, index_JavaScriptVarName as JavaScriptVarName, index_ScopeSelector as ScopeSelector, type index_Settings as Settings, index_SettingsSchema as SettingsSchema, type index_TaggerConfig as TaggerConfig, index_TaggerSchema as TaggerSchema, index_settings as settings, index_tagger as tagger };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { index as schemas };
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
|
+
import { z } from '@walkeros/core/dev';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Data attribute prefix
|
|
6
|
+
* Used for DOM event tracking
|
|
7
|
+
*/
|
|
8
|
+
declare const DataAttributePrefix: z.ZodString;
|
|
9
|
+
/**
|
|
10
|
+
* JavaScript variable name
|
|
11
|
+
* Used for global function names
|
|
12
|
+
*/
|
|
13
|
+
declare const JavaScriptVarName: z.ZodString;
|
|
14
|
+
/**
|
|
15
|
+
* DOM scope selector
|
|
16
|
+
* Note: Runtime type is Element | Document (non-serializable)
|
|
17
|
+
*/
|
|
18
|
+
declare const ScopeSelector: z.ZodOptional<z.ZodString>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Browser source settings schema
|
|
22
|
+
*/
|
|
23
|
+
declare const SettingsSchema: z.ZodObject<{
|
|
24
|
+
prefix: z.ZodDefault<z.ZodString>;
|
|
25
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
26
|
+
pageview: z.ZodDefault<z.ZodBoolean>;
|
|
27
|
+
session: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodAny]>>;
|
|
28
|
+
elb: z.ZodDefault<z.ZodString>;
|
|
29
|
+
name: z.ZodOptional<z.ZodString>;
|
|
30
|
+
elbLayer: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodAny]>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
type Settings = z.infer<typeof SettingsSchema>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Tagger configuration schema
|
|
36
|
+
* Used for automatic data attribute generation
|
|
37
|
+
*/
|
|
38
|
+
declare const TaggerSchema: z.ZodObject<{
|
|
39
|
+
prefix: z.ZodDefault<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
type TaggerConfig = z.infer<typeof TaggerSchema>;
|
|
42
|
+
|
|
43
|
+
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
44
|
+
declare const tagger: _walkeros_core_dev.JSONSchema;
|
|
45
|
+
|
|
46
|
+
declare const index_DataAttributePrefix: typeof DataAttributePrefix;
|
|
47
|
+
declare const index_JavaScriptVarName: typeof JavaScriptVarName;
|
|
48
|
+
declare const index_ScopeSelector: typeof ScopeSelector;
|
|
49
|
+
type index_Settings = Settings;
|
|
50
|
+
declare const index_SettingsSchema: typeof SettingsSchema;
|
|
51
|
+
type index_TaggerConfig = TaggerConfig;
|
|
52
|
+
declare const index_TaggerSchema: typeof TaggerSchema;
|
|
53
|
+
declare const index_settings: typeof settings;
|
|
54
|
+
declare const index_tagger: typeof tagger;
|
|
55
|
+
declare namespace index {
|
|
56
|
+
export { index_DataAttributePrefix as DataAttributePrefix, index_JavaScriptVarName as JavaScriptVarName, index_ScopeSelector as ScopeSelector, type index_Settings as Settings, index_SettingsSchema as SettingsSchema, type index_TaggerConfig as TaggerConfig, index_TaggerSchema as TaggerSchema, index_settings as settings, index_tagger as tagger };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { index as schemas };
|