@caruuto/caruuto-js 0.6.0 → 0.7.0
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/CHANGELOG.md +10 -0
- package/lib/extensions/ai.js +25 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
7
|
|
|
8
|
+
## 0.7.0 - 2026-06-08
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `ai.query()`, `ai.stream()`, and `ai.context()` now accept `utmSource`,
|
|
13
|
+
`utmMedium`, `utmCampaign`, `utmTerm`, and `utmContent` options, sent through
|
|
14
|
+
as `utm_source` / `utm_medium` / `utm_campaign` / `utm_term` / `utm_content`
|
|
15
|
+
alongside the existing `referrerUrl`. Lets callers forward acquisition data
|
|
16
|
+
from the page URL so Caruuto can attribute AI sessions to a referral channel.
|
|
17
|
+
|
|
8
18
|
## 0.3.6 - 2024-09-06
|
|
9
19
|
|
|
10
20
|
### Added
|
package/lib/extensions/ai.js
CHANGED
|
@@ -13,6 +13,11 @@ module.exports = function (CaruutoClient, clientInstance) {
|
|
|
13
13
|
* @param {string} [opts.clientSessionId] - Client's anonymous user token
|
|
14
14
|
* @param {string} [opts.source] - 'widget' | 'api' | 'embed'
|
|
15
15
|
* @param {string} [opts.referrerUrl] - URL where the chat is embedded
|
|
16
|
+
* @param {string} [opts.utmSource] - UTM source param from the page URL
|
|
17
|
+
* @param {string} [opts.utmMedium] - UTM medium param from the page URL
|
|
18
|
+
* @param {string} [opts.utmCampaign] - UTM campaign param from the page URL
|
|
19
|
+
* @param {string} [opts.utmTerm] - UTM term param from the page URL
|
|
20
|
+
* @param {string} [opts.utmContent] - UTM content param from the page URL
|
|
16
21
|
* @param {string} [opts.leadEmail] - Capture a lead email on this turn
|
|
17
22
|
* @param {string} [opts.leadName] - Lead name (paired with leadEmail)
|
|
18
23
|
* @param {string} [opts.type] - Restrict retrieval to a single knowledge type
|
|
@@ -137,6 +142,11 @@ module.exports = function (CaruutoClient, clientInstance) {
|
|
|
137
142
|
clientSessionId,
|
|
138
143
|
source,
|
|
139
144
|
referrerUrl,
|
|
145
|
+
utmSource,
|
|
146
|
+
utmMedium,
|
|
147
|
+
utmCampaign,
|
|
148
|
+
utmTerm,
|
|
149
|
+
utmContent,
|
|
140
150
|
type,
|
|
141
151
|
maxItems
|
|
142
152
|
} = opts
|
|
@@ -147,6 +157,11 @@ module.exports = function (CaruutoClient, clientInstance) {
|
|
|
147
157
|
if (clientSessionId) body.client_session_id = clientSessionId
|
|
148
158
|
if (source) body.source = source
|
|
149
159
|
if (referrerUrl) body.referrer_url = referrerUrl
|
|
160
|
+
if (utmSource) body.utm_source = utmSource
|
|
161
|
+
if (utmMedium) body.utm_medium = utmMedium
|
|
162
|
+
if (utmCampaign) body.utm_campaign = utmCampaign
|
|
163
|
+
if (utmTerm) body.utm_term = utmTerm
|
|
164
|
+
if (utmContent) body.utm_content = utmContent
|
|
150
165
|
if (type) body.type = type
|
|
151
166
|
if (maxItems !== undefined) body.max_items = maxItems
|
|
152
167
|
|
|
@@ -320,6 +335,11 @@ function buildRequestBody(opts, stream) {
|
|
|
320
335
|
clientSessionId,
|
|
321
336
|
source,
|
|
322
337
|
referrerUrl,
|
|
338
|
+
utmSource,
|
|
339
|
+
utmMedium,
|
|
340
|
+
utmCampaign,
|
|
341
|
+
utmTerm,
|
|
342
|
+
utmContent,
|
|
323
343
|
leadEmail,
|
|
324
344
|
leadName,
|
|
325
345
|
type,
|
|
@@ -332,6 +352,11 @@ function buildRequestBody(opts, stream) {
|
|
|
332
352
|
if (clientSessionId) body.client_session_id = clientSessionId
|
|
333
353
|
if (source) body.source = source
|
|
334
354
|
if (referrerUrl) body.referrer_url = referrerUrl
|
|
355
|
+
if (utmSource) body.utm_source = utmSource
|
|
356
|
+
if (utmMedium) body.utm_medium = utmMedium
|
|
357
|
+
if (utmCampaign) body.utm_campaign = utmCampaign
|
|
358
|
+
if (utmTerm) body.utm_term = utmTerm
|
|
359
|
+
if (utmContent) body.utm_content = utmContent
|
|
335
360
|
if (leadEmail) body.lead_email = leadEmail
|
|
336
361
|
if (leadName) body.lead_name = leadName
|
|
337
362
|
if (type) body.type = type
|