saasco-sdk 0.1.44 → 0.2.3

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/package.json CHANGED
@@ -1,14 +1,53 @@
1
1
  {
2
2
  "name": "saasco-sdk",
3
- "version": "0.1.44",
3
+ "version": "0.2.3",
4
+ "files": [
5
+ "dist"
6
+ ],
7
+ "type": "module",
8
+ "main": "./dist/index.cjs",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.cjs"
16
+ },
17
+ "./support-chat": {
18
+ "types": "./dist/support-chat.d.ts",
19
+ "import": "./dist/support-chat.js",
20
+ "require": "./dist/support-chat.cjs"
21
+ }
22
+ },
4
23
  "dependencies": {
5
- "tslib": "^2.3.0",
24
+ "@ai-sdk/provider-utils": "^5.0.0",
25
+ "@ai-sdk/react": "^4.0.2",
6
26
  "@lukeed/uuid": "^2.0.1",
7
- "zod": "^3.22.4",
8
- "psl": "^1.9.0",
9
- "js-sha256": "^0.11.1"
10
- },
11
- "main": "./index.cjs.js",
12
- "typings": "./src/index.d.ts",
13
- "module": "./index.esm.js"
14
- }
27
+ "@radix-ui/react-slot": "^1.3.1",
28
+ "@shadcn/react": "^0.2.1",
29
+ "ai": "^7.0.2",
30
+ "js-sha256": "^0.11.1",
31
+ "psl": "^1.15.0",
32
+ "tslib": "^2.3.0",
33
+ "zod": "^4.1.12"
34
+ },
35
+ "peerDependencies": {
36
+ "react": ">=18",
37
+ "react-dom": ">=18"
38
+ },
39
+ "peerDependenciesMeta": {
40
+ "react": {
41
+ "optional": true
42
+ },
43
+ "react-dom": {
44
+ "optional": true
45
+ }
46
+ },
47
+ "scripts": {
48
+ "build:css": "node ./scripts/build-widget-css.mjs",
49
+ "build": "pnpm build:css && tsup",
50
+ "build:npm": "pnpm build:css && BUILD_TARGET=npm tsup",
51
+ "build:cdn": "pnpm build:css && BUILD_TARGET=cdn tsup"
52
+ }
53
+ }
package/README.md DELETED
@@ -1,546 +0,0 @@
1
- [Saasco](https://www.saasco.com) is a platform of saas apps where members only pay the infrastructure cost of what they use. As a result Saasco apps are up to 99% cheaper than traditional saas products.
2
-
3
- ---
4
-
5
- - [Privacy](#privacy)
6
- - [Getting Started](#getting-started)
7
- - [Automatic Page View Tracking](#automatic-page-view-tracking)
8
- - [Tracking Events](#tracking-events)
9
- - [Identifying Users](#identifying-users)
10
- - [Debugging and Dev](#debugging-and-dev)
11
- - [Reserved Properties](#reserved-properties)
12
-
13
- <br />
14
-
15
- ## 🔒 Privacy
16
-
17
- By default Saasco is privacy friendly, obscuring all activity behind Anonymous IDs. However if you want to power more complex user tracking you can identify users and then all events they do will be attributed to them in your CRM. This can assist with customer support but also for things like drip campaigns and other marketing activities.
18
-
19
- ## Getting Started
20
-
21
- Install by running:
22
- `npm install saasco-sdk`
23
-
24
- Copy your Project ID from the project settings page in Saasco:
25
- [https://www.saasco.com/projects/your-project/apps/dashboard/settings/project](https://www.saasco.com/projects/your-project/apps/dashboard/settings/project)
26
-
27
- Then import Saasco and initialize the lib with your Project ID.
28
-
29
- ```ts
30
- // lib/saasco.ts
31
- import { Saasco } from 'saasco-sdk';
32
-
33
- export const saasco = new Saasco({ projectId: 'YOUR-PROJECT-ID' });
34
- ```
35
-
36
- ## Automatic Page View Tracking
37
-
38
- When you initialize the lib Saasco will automatically start tracking all page views in your app. By default, it tracks all URL changes, including query parameters and hash changes. You can customize this behavior using the `autoPageTracking` configuration object:
39
-
40
- ```typescript
41
- const analytics = new Saasco({
42
- projectId: 'your-project-id',
43
- autoPageTracking: {
44
- enabled: true, // Set to false to disable automatic page tracking
45
- trackQueryParams: true, // Set to false to ignore URL query parameter changes
46
- trackHash: true, // Set to false to ignore URL hash changes
47
- },
48
- });
49
-
50
- analytics.init();
51
- ```
52
-
53
- You can also [manually track pages](https://www.notion.so/Manual-Page-Tracking-in-SPAs-2442fc7586dc4208ae8f669eb7561b1a?pvs=21) by disabling automatic page tracking (`enabled: false`). For most use cases you don't need to do this.
54
-
55
- ## Tracking Events
56
-
57
- With events you can track custom actions users are taking on your site with event properties. The track method supports both client-side (parameter-style) and server-side (object-style) usage patterns.
58
-
59
- Each event has 2 components:
60
-
61
- **Name** - this is the name of the action that was taken.
62
-
63
- _We like to follow Segment's [Object Action Framework](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/) for naming events._
64
-
65
- **Properties** - This is an object with the values of the event. Such as the value, currency, or query.
66
-
67
- We currently have limited support for properties, but in the future we will support complex querying and actions based on event properties.
68
-
69
- ### Client Usage
70
-
71
- For client-side tracking, use the Segment-compatible syntax.
72
- This will automatically assign userId based on identify calls during the session
73
-
74
- ```tsx
75
- // Import saasco
76
- import { saasco } from '../lib/saasco.ts';
77
-
78
- // Track an event
79
- saasco.track("Searched Movies");
80
-
81
- // Track an event with properties
82
- saasco.track("Searched Movies", {
83
- query:"batman",
84
- sortBy:"relevancy"
85
- });
86
- ```
87
-
88
- ### Server Usage (Object Style)
89
-
90
- For server-side tracking, use the object-style syntax.
91
- You must provide a userId for server side tracking events so there is a contact to connect the events to.
92
-
93
- ```tsx
94
- // Import saasco
95
- import { saasco } from '../lib/saasco.ts';
96
-
97
- // Track an event and associate it with a user
98
- saasco.track({
99
- event: "Signed Up",
100
- userId: "user_123",
101
- properties: {
102
- provider: 'email',
103
- }
104
- });
105
- ```
106
-
107
- ## Identifying Users
108
-
109
- By default Saasco does not track any identifiable data about users, just anonymous user ids and session ids. However if you want to tie events to users you can identify users which will connect events to users in your CRM and power tools like drip campaigns and customer support.
110
-
111
- To do this just identify a user with their DistinctId (usually the user ID from your database) and then any properties on the user.
112
-
113
- ```tsx
114
- // Import saasco
115
- import { saasco } from '../lib/saasco.ts';
116
-
117
- // Inside your user logged in function identify a user
118
- // You should only identify users when they login, or their properties change
119
- function signedIn(){
120
- // Identify a user
121
- saasco.identify("USER-ID-FROM-YOUR-DB", {
122
- // Any user properties you want to record with the user
123
- name:"Tony Hawk",
124
- email:"tony@xgames.com",
125
- bestTrick: 900
126
- });
127
- }
128
-
129
- // When a user logs out you can unidentify by identify null
130
- function signedOut(){
131
- saasco.identify(null)
132
- }
133
- ```
134
-
135
- ### Identifying users who don't have an ID
136
-
137
- Often times you have a user's contact details before they sign up for your site. This could be part of the signup flow, or if they were to subscribe to marketing emails before they sign up as a customer
138
-
139
- Saasco allows identifying users without an id by simply skipping the `ID` part of the identify call. This will add contacts to the CRM for email marketing and other tools before users register.
140
-
141
- For example:
142
-
143
- ```tsx
144
- // Identify a user only by their email
145
- saasco.identify({
146
- name:"Tony Hawk",
147
- email:"tony@xgames.com",
148
- bestTrick: 900
149
- });
150
- ```
151
-
152
- By doing this users will get tracked and added to your contacts, and as soon as they do login, assuming they use the same email address, all their properties will be connected.
153
-
154
- ### Soft vs Full identify
155
-
156
- When users are identified without an `ID` we call this a "Soft Identify". Users who are soft identified can also be called "Leads".
157
- Once a user signs up and you identify them with an `ID` they will be fully registered and can be called "Customers"
158
-
159
- In the CRM when you identify a user, either soft or full, they become a contact.
160
- The type of the contact depends on whether they were fully identified, "Leads" are soft and "Customers" are full.
161
-
162
- ## Debugging and Dev
163
-
164
- When setting up Saasco analytics you probably want to exclude your local environment.
165
-
166
- To do so simply turn on dev mode.
167
-
168
- ```tsx
169
- export const saasco = new Saasco({
170
- projectId: 'YOUR-PROJECT-ID',
171
-
172
- // use an env to only set enabled to true on production
173
- enabled: process.env['NODE_ENV'] === 'production',
174
- });
175
- ```
176
-
177
- #### Debugging
178
-
179
- You can turn on debugging when you initialize the repo or by running `saasco.enableDebug()` in your code or the browser.
180
-
181
- ```tsx
182
- export const saasco = new Saasco({
183
- projectId: 'YOUR-PROJECT-ID',
184
- enabled: process.env['NODE_ENV'] === 'production',
185
- // Set to true to console log analytics events.
186
- // This works even when enabled is false - it just won't send the data
187
- debug: true,
188
- });
189
- ```
190
-
191
- You can also enable debug mode by calling `saasco.enableDebug()` anywhere in your code.
192
-
193
- ```tsx
194
- saasco.enableDebug();
195
- // will console log "debug mode activated"
196
- ```
197
-
198
- You can disable debug mode by calling `saasco.disableDebug()`.
199
-
200
- ```tsx
201
- saasco.disableDebug();
202
- // will console log "debug mode deactivated"
203
- ```
204
-
205
- ## Reserved Properties
206
-
207
- Saasco has reserved some properties that have semantic meanings for contacts and will handle them in special ways.
208
- For example, Saasco always expects email to be a string of the user's email address, this is important for when sending emails using the marketing app.
209
- The SDK will do its best to match these properties, eg (created_at will be mapped to createdAt), but if possible you should use the reserved properties.
210
-
211
- ### Reserved Contact Properties
212
-
213
- | PROPERTY | TYPE | DESCRIPTION |
214
- | ----------- | ------ | ----------------------------------------------------------------------------------------------------------------- |
215
- | age | Number | Age of a user |
216
- | avatar | String | URL to an avatar image for the user |
217
- | birthday | Date | User's birthday |
218
- | createdAt | Date | Date the user's account was first created. We recommend using ISO-8601 date strings. |
219
- | description | String | Description of the user |
220
- | email | String | Email address of a user |
221
- | firstName | String | First name of a user |
222
- | displayName | String | The preferred user's display name, will default to "firstName lastName" |
223
- | gender | String | Gender of a user |
224
- | lastName | String | Last name of a user |
225
- | name | String | Full name of a user. If you only pass a first and last name Segment automatically fills in the full name for you. |
226
- | phone | String | Phone number of a user |
227
- | title | String | Title of a user, usually related to their position at a specific company. Example: "VP of Engineering" |
228
- | username | String | User's username. This should be unique to each user, like the usernames of Twitter or GitHub. |
229
- | website | String | Website of a user |
230
-
231
- ### Default Contact Properties
232
-
233
- Our SDKs automatically collect certain properties on every event or user profile.
234
- Any property that starts with `$` is a property that has been generated by the SDK or ingestion.
235
-
236
- | Property | Display Name | Description |
237
- | ----------------------- | --------------------------- | -------------------------------------------------------------------------------------- |
238
- | $id | ID | The ID of the user from your database, coerced to a string. eg 1 becomes "1" |
239
- | $city | City | The city of the user parsed from the IP. |
240
- | $countryCode | Country Code | The country of the user parsed from the IP property. |
241
- | $latitude | Latitude | Latitude of the user's IP location. |
242
- | $longitude | Longitude | Longitude of the user's IP location. |
243
- | $timezone | Timezone | Timezone of the user parsed from the IP. |
244
- | $locale | Locale | The most recent preferred language of the user. |
245
- | $screenHeight | Screen Height | The most recent height of the device screen in pixels |
246
- | $screenWidth | Screen Width | The most recent width of the device screen in pixels |
247
- | $screenDpi | Screen DPI | The most recent pixel density of the device screen. |
248
- | $lastSeen | Last Seen | The last time a user was identified while active was not false in the context |
249
- | $os | Operating System | The most recent OS of the user. |
250
- | $browser | Browser | The most recent browser of the user. |
251
- | $browserVersion | Browser Version | The most recent browser version of the user. |
252
- | $initialReferrer | Initial Referrer | Referring URL when the user first arrived on your site. Defaults to "direct" |
253
- | $referrer | Last Touch Referrer | Referring URL when the user last interacted with your site. Defaults to "direct" |
254
- | $initialReferringDomain | Initial Referring Domain | Referring domain at first arrival. Defaults to "direct" |
255
- | $referringDomain | Last Touch Referring Domain | Referring domain at the user's last interaction. Defaults to "direct" |
256
- | $initialUtmSource | Initial UTM Source | The initial UTM source tag from the URL a customer clicked to arrive at your domain. |
257
- | $utmSource | Last Touch UTM Source | The UTM source tag from the URL a customer clicked during their last interaction. |
258
- | $initialUtmMedium | Initial UTM Medium | The initial UTM medium tag from the URL a customer clicked to arrive at your domain. |
259
- | $utmMedium | Last Touch UTM Medium | The UTM medium tag from the URL a customer clicked during their last interaction. |
260
- | $initialUtmCampaign | Initial UTM Campaign | The initial UTM campaign tag from the URL a customer clicked to arrive at your domain. |
261
- | $utmCampaign | Last Touch UTM Campaign | The UTM campaign tag from the URL a customer clicked during their last interaction. |
262
- | $initialUtmTerm | Initial UTM Term | The initial UTM term tag from the URL a customer clicked to arrive at your domain. |
263
- | $utmTerm | Last Touch UTM Term | The UTM term tag from the URL a customer clicked during their last interaction. |
264
- | $initialUtmContent | Initial UTM Content | The initial UTM content tag from the URL a customer clicked to arrive at your domain. |
265
- | $utmContent | Last Touch UTM Content | The UTM content tag from the URL a customer clicked during their last interaction. |
266
- | $unsubscribed | Unsubscribed | Whether the user has unsubscribed from all notifications |
267
- | $unsubscribeReason | Unsubscribe Reason | The reason the user was unsubscribed - eg complained, bounced, requested |
268
-
269
- ### Reserved Integration Properties
270
-
271
- | Property | Display Name | Description |
272
- | ----------------- | ------------------ | ------------------------------------------------ |
273
- | $stripeCustomerId | Stripe Customer Id | The Stripe customer ID associated with this user |
274
-
275
- ### Reserved event properties
276
-
277
- Properties used to calculate revenue for different traffic sources and LTV for users.
278
-
279
- | PROPERTY | TYPE | DESCRIPTION |
280
- | -------- | ------ | ----------------------------------------------------------------------------------------- |
281
- | revenue | Number | Amount of revenue an event resulted in. This should be a decimal value |
282
- | currency | String | Currency of the revenue an event resulted in. This should be sent in the ISO 4127 format. |
283
- | value | Number | An abstract numerical value used internally to score events, such as lead scoring. |
284
-
285
- ### Default Event Properties
286
-
287
- Our SDKs automatically collect certain properties on every event or user profile. The default properties begin with a `$` and can be overwritten with your own identify calls, so we recommend avoiding leading `$` in your identify call properties to avoid conflicts.
288
-
289
- | Property | Display Name | Description |
290
- | ---------------- | --------------------------- | -------------------------------------------------------------------------------- |
291
- | $city | City | The city of the user parsed from the IP. |
292
- | $countryCode | Country Code | The country of the user parsed from the IP property. |
293
- | $latitude | Latitude | Latitude of the user's IP location. |
294
- | $longitude | Longitude | Longitude of the user's IP location. |
295
- | $timezone | Timezone | Timezone of the user parsed from the IP. |
296
- | $locale | Locale | The preferred language of the user. |
297
- | $pathname | Pathname | The path of the page on which the event was tracked. |
298
- | $title | Page Title | The title of the page on which the event was tracked. |
299
- | $userAgent | User Agent | The user agent string of the browser. |
300
- | $screenHeight | Screen Height | The height of the device screen in pixels |
301
- | $screenWidth | Screen Width | The width of the device screen in pixels |
302
- | $screenDpi | Screen DPI | Pixel density of the device screen. |
303
- | $currentUrl | Current URL | The URL of the page on which the event was tracked. |
304
- | $os | Operating System | The most recent OS of the user. |
305
- | $browser | Browser | The most recent browser of the user. |
306
- | $browserVersion | Browser Version | The most recent browser version of the user. |
307
- | $device | Device Type | The most recent device type of the user. eg `Mobile`, `Tablet`, `Desktop` |
308
- | $referrer | Last Touch Referrer | Referring URL when the user last interacted with your site. Defaults to "direct" |
309
- | $referringDomain | Last Touch Referring Domain | Referring domain at the user's last interaction. Defaults to "direct" |
310
- | $utmSource | UTM Source | The UTM source tag from the URL a customer clicked to arrive at your domain. |
311
- | $utmMedium | UTM Medium | The UTM medium tag from the URL a customer clicked to arrive at your domain. |
312
- | $utmCampaign | UTM Campaign | The UTM campaign tag from the URL a customer clicked to arrive at your domain. |
313
- | $utmTerm | UTM Term | The UTM term tag from the URL a customer clicked to arrive at your domain. |
314
- | $utmContent | UTM Content | The UTM content tag from the URL a customer clicked to arrive at your domain. |
315
-
316
- ### Reserved Events with Optional Properties
317
-
318
- > ⚠️ The event schema described below is not yet implemented in the UI. However, if you wish to future-proof your implementation, you can start using this schema in anticipation of its integration.
319
-
320
- Reserved events are common events that happen during the lifecycle of a user, with optional properties to capture more detailed information, including revenue data where appropriate.
321
-
322
- - [Signed Up](#signed-up)
323
- - [Signed In](#signed-in)
324
- - [Signed Out](#signed-out)
325
- - [Trial Started](#trial-started)
326
- - [Trial Ended](#trial-ended)
327
- - [Payment Completed](#payment-completed)
328
- - [Subscription Started](#subscription-started)
329
- - [Subscription Cancelled](#subscription-cancelled)
330
- - [Subscription Upgraded](#subscription-upgraded)
331
- - [Subscription Downgraded](#subscription-downgraded)
332
-
333
- #### Signed Up
334
-
335
- Event triggered when a user signs up.
336
- | Property | Description |
337
- |----------|----------------------------------|
338
- | `source` | How the user found your site. |
339
- | `value` | Track an estimated value of the signup|
340
-
341
- Example:
342
-
343
- ```jsx
344
- saasco.track('Signed Up', {
345
- source: 'Referral by friend',
346
- });
347
- ```
348
-
349
- #### Signed In
350
-
351
- Event triggered when a user signs in.
352
- | Property | Description |
353
- |----------|--------------------------------------------------|
354
- | `provider` | The provider used for signing in (e.g., email, github, google). |
355
-
356
- Example:
357
-
358
- ```jsx
359
- saasco.track('Signed In', {
360
- provider: 'email',
361
- });
362
- ```
363
-
364
- Note:
365
- When tracking Signed In events call identify('user_id', {email: '...'}) before the event to connect to the user.
366
-
367
- #### Signed Out
368
-
369
- Event triggered when a user signs out.
370
- No optional properties.
371
-
372
- Example:
373
-
374
- ```jsx
375
- saasco.track('Signed Out');
376
- ```
377
-
378
- Note:
379
- When tracking Signed Out events call identify(null) _after_ tracking the event to reset the session.
380
-
381
- #### Trial Started
382
-
383
- Event triggered when a user starts a trial.
384
- | Property | Description |
385
- |-------------------|---------------------------------------------------------------------|
386
- | `duration` | The duration of the trial in days |
387
- | `type`| Values can be `optIn` for when the user didn't provide a cc or `optOut` when the user provided a cc and it will automatically start at the end of the trial period|
388
-
389
- Example:
390
-
391
- ```jsx
392
- saasco.track('Trial Started', { duration: 14, type: 'optOut' });
393
- ```
394
-
395
- #### Trial Ended
396
-
397
- Event triggered when a user's trial ends.
398
- | Property | Description |
399
- |-------------------|---------------------------------------------------------------------|
400
- | `daysLeftInTrial`| If a user manually upgrades before the end of the trial you can record this here|
401
-
402
- Example:
403
-
404
- ```jsx
405
- saasco.track('Trial Ended', { daysLeftInTrial: 4 });
406
- ```
407
-
408
- #### Payment Completed
409
-
410
- Event triggered when a payment is completed.
411
- This may be called on the server side after a confirmation webhook.
412
- This is helpful for recording ongoing subscription payments.
413
-
414
- | Property | Description |
415
- | ---------- | --------------------------------------------------- |
416
- | `revenue` | The initial payment amount. |
417
- | `currency` | The currency of the payment, otherwise assumed USD. |
418
-
419
- Example:
420
-
421
- ```jsx
422
- saasco.track('Payment Completed', { revenue: 29.99, currency: 'GBP' });
423
- ```
424
-
425
- #### Subscription Started
426
-
427
- Event triggered when a user starts a subscription.
428
- If you have integrated with stripe for revenue tracking or are doing server side revenue tracking with webhooks you should skip the `revenue` and `currency` properties to prevent duplicate revenue tracking.
429
-
430
- | Property | Description |
431
- | ---------- | ----------------------------------------------------------------------------------------------------------------------- |
432
- | `plan` | The name or ID of the subscription plan. |
433
- | `revenue` | The initial payment amount. Exclude if triggering `Payment Completed` to avoid double counting. |
434
- | `currency` | The currency of the payment, otherwise assumed USD. Exclude if triggering `Payment Completed` to avoid double counting. |
435
-
436
- Example:
437
-
438
- ```jsx
439
- saasco.track('Subscription Started', {
440
- plan: 'Monthly',
441
- });
442
- ```
443
-
444
- #### Subscription Cancelled
445
-
446
- Event triggered when a subscription is cancelled.
447
-
448
- | Property | Description |
449
- | -------- | -------------------------------------------------------------------------------------------------- |
450
- | `reason` | The reason for cancellation. This can be used in the feedback and analysis of cancellation reasons |
451
-
452
- Example:
453
-
454
- ```jsx
455
- saasco.track('Subscription Cancelled', {
456
- reason: 'Not using it any more',
457
- });
458
- ```
459
-
460
- #### Subscription Upgraded
461
-
462
- Event triggered when a subscription is upgraded.
463
- | Property | Description |
464
- |-----------------|-----------------------------------------------------------------------------------------------|
465
- | `fromPlan` | The previous plan. |
466
- | `toPlan` | The new plan. |
467
- | `previousRevenue` | The revenue from the previous plan. |
468
- | `newRevenue` | The revenue from the new plan. |
469
- | `revenue` | If the customer is charged immediately then include a revenue number here |
470
- | `currency` | The currency of the payment, assumed to be USD unless otherwise specified. |
471
-
472
- Example:
473
-
474
- ```jsx
475
- saasco.track('Subscription Upgraded', {
476
- fromPlan: 'Monthly',
477
- toPlan: 'Annual',
478
- previousRevenue: 29,
479
- newRevenue: 129,
480
- });
481
- ```
482
-
483
- #### Subscription Downgraded
484
-
485
- Event triggered when a subscription is downgraded.
486
- | Property | Description |
487
- |------------|-------------------|
488
- | `fromPlan` | The previous plan. |
489
- | `toPlan` | The new plan. |
490
- | `previousRevenue` | The revenue from the previous plan. |
491
- | `newRevenue` | The revenue from the new plan. |
492
- | `revenue` | If the customer is refunded immediately then include a revenue number here, in the case of a downgrade this will be a negative value. Only include the revenue here if it's not tracked on your backend or with a webhook |
493
- | `currency` | The currency of the payment, assumed to be USD unless otherwise specified. |
494
-
495
- Example:
496
-
497
- ```jsx
498
- saasco.track('Subscription Downgraded', {
499
- fromPlan: 'Annual',
500
- toPlan: 'Monthly',
501
- previousRevenue: 129,
502
- newRevenue: 29,
503
- revenue: -36,
504
- currency: 'USD',
505
- });
506
- ```
507
-
508
- ## Use the hosted SDK
509
-
510
- To use the hosted JS SDK, add the following script to your HTML header:
511
- All properties should be added as data attributes in the format data-[prop name]
512
-
513
- ```jsx
514
- <script
515
- src="https://saasco.com/sdk/saasco-sdk.js"
516
- data-projectId="YOUR-PROJECT-ID"
517
- ></script>
518
- ```
519
-
520
- All the properties for initializing the sdk can be passed in like this:
521
-
522
- ```jsx
523
- <script
524
- src="https://saasco.com/sdk/saasco-sdk.js"
525
- data-projectId="YOUR-PROJECT-ID"
526
- data-debug="true" // pass any properties as data params
527
- ></script>
528
- ```
529
-
530
- You can then call the track and identify methods like so:
531
-
532
- ```jsx
533
- saasco.track('Searched Movies');
534
- ```
535
-
536
- For type safety in your TypeScript project, you can use the following in an `index.d.ts` file
537
-
538
- ```jsx
539
- import { Saasco } from 'saasco-sdk';
540
-
541
- declare global {
542
- interface Window {
543
- saasco?: Saasco;
544
- }
545
- }
546
- ```
package/index.cjs.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index";