@bigbeakads/smartads-sdk-js 0.0.4 → 0.0.5
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 +18 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,11 @@ const smartAds = new SmartAds({
|
|
|
17
17
|
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const smartId = new URL(window.location.href).searchParams.get('smartId');
|
|
21
|
+
await smartAds.report({
|
|
22
|
+
smartId: smartId,
|
|
23
|
+
eventName: 'EVENT_CONTENT_VIEW',
|
|
24
|
+
});
|
|
21
25
|
```
|
|
22
26
|
|
|
23
27
|
### UMD (Script Tag)
|
|
@@ -25,11 +29,15 @@ await smartAds.report({ eventName: 'EVENT_CONTENT_VIEW' });
|
|
|
25
29
|
```html
|
|
26
30
|
<script src="https://unpkg.com/@bigbeakads/smartads-sdk-js/dist/umd/smartads-sdk-js.min.js"></script>
|
|
27
31
|
<script>
|
|
28
|
-
|
|
32
|
+
const smartAds = new SmartAds({
|
|
29
33
|
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
30
34
|
});
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
const smartId = new URL(window.location.href).searchParams.get('smartId');
|
|
37
|
+
smartAds.report({
|
|
38
|
+
smartId: smartId,
|
|
39
|
+
eventName: 'EVENT_CONTENT_VIEW',
|
|
40
|
+
});
|
|
33
41
|
</script>
|
|
34
42
|
```
|
|
35
43
|
|
|
@@ -47,17 +55,22 @@ Creates a SmartAds SDK instance.
|
|
|
47
55
|
|
|
48
56
|
Reports an event to the SmartAds server. Returns a `Promise<Response>`. Supports both Promise and callback patterns.
|
|
49
57
|
|
|
58
|
+
> **Note:** When users are redirected to your landing page, a `smartId` parameter will be included in the URL. You should extract this value and pass it to the `report` method.
|
|
59
|
+
|
|
50
60
|
#### Parameters
|
|
51
61
|
|
|
52
62
|
| Parameter | Type | Required | Default | Description |
|
|
53
63
|
| ----------- | -------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `smartId` | `string` | **Yes** | — | Smart ID, obtained from URL parameters |
|
|
54
65
|
| `eventName` | `EventName` | **Yes** | — | The event name to report. Supported values: `EVENT_ADD_TO_CART`, `EVENT_PURCHASE`, `EVENT_CONTENT_VIEW`, `EVENT_COMPLETE_REGISTRATION`, `EVENT_FIRST_DEPOSIT`, `EVENT_INITIATE_CHECKOUT` |
|
|
55
66
|
| `callback` | `(response) => void` | No | — | Response callback |
|
|
56
67
|
|
|
57
68
|
#### Promise Usage
|
|
58
69
|
|
|
59
70
|
```js
|
|
71
|
+
const smartId = new URL(window.location.href).searchParams.get('smartId');
|
|
60
72
|
const response = await smartAds.report({
|
|
73
|
+
smartId: smartId,
|
|
61
74
|
eventName: 'EVENT_PURCHASE',
|
|
62
75
|
});
|
|
63
76
|
console.log('Response:', response);
|
|
@@ -66,7 +79,9 @@ console.log('Response:', response);
|
|
|
66
79
|
#### Callback Usage
|
|
67
80
|
|
|
68
81
|
```js
|
|
82
|
+
const smartId = new URL(window.location.href).searchParams.get('smartId');
|
|
69
83
|
smartAds.report({
|
|
84
|
+
smartId: smartId,
|
|
70
85
|
eventName: 'EVENT_PURCHASE',
|
|
71
86
|
callback: (response) => {
|
|
72
87
|
console.log('Response:', response);
|