saasco-sdk 0.1.40 → 0.1.42
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/index.cjs.js +293 -539
- package/index.esm.js +292 -535
- package/package.json +3 -2
- package/src/lib/analytics.d.ts +2 -1
- package/src/lib/integrations/index.d.ts +1 -0
- package/src/lib/integrations/tiktok-pixel.d.ts +59 -0
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saasco-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.0",
|
|
6
6
|
"@lukeed/uuid": "^2.0.1",
|
|
7
7
|
"zod": "^3.22.4",
|
|
8
|
-
"psl": "^1.9.0"
|
|
8
|
+
"psl": "^1.9.0",
|
|
9
|
+
"js-sha256": "^0.11.1"
|
|
9
10
|
},
|
|
10
11
|
"main": "./index.cjs.js",
|
|
11
12
|
"typings": "./src/index.d.ts",
|
package/src/lib/analytics.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FacebookPixelIntegrationConfig } from './integrations/facebook-pixel';
|
|
2
|
+
import { TikTokPixelIntegrationConfig } from './integrations/tiktok-pixel';
|
|
2
3
|
declare global {
|
|
3
4
|
interface Window {
|
|
4
5
|
saascoAutoPageTrackingActive?: boolean;
|
|
@@ -29,7 +30,7 @@ export type IntegrationConfigBase = {
|
|
|
29
30
|
type: string;
|
|
30
31
|
config: Record<string, any>;
|
|
31
32
|
};
|
|
32
|
-
export type IntegrationsConfig = FacebookPixelIntegrationConfig[];
|
|
33
|
+
export type IntegrationsConfig = (FacebookPixelIntegrationConfig | TikTokPixelIntegrationConfig)[];
|
|
33
34
|
export declare class Saasco {
|
|
34
35
|
private config;
|
|
35
36
|
private lastPageViewPath;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TikTok Pixel Integration
|
|
3
|
+
*
|
|
4
|
+
* This integration provides TikTok Pixel tracking capabilities including:
|
|
5
|
+
* - Event tracking for standard and custom events
|
|
6
|
+
* - Advanced matching with hashed user identification data
|
|
7
|
+
* - Automatic script loading and initialization
|
|
8
|
+
*
|
|
9
|
+
* Key Resources:
|
|
10
|
+
* - Advanced Matching: https://business-api.tiktok.com/portal/docs?rid=5ipocbxyw8v&id=1739585700402178
|
|
11
|
+
* - Standard Events: https://business-api.tiktok.com/portal/docs?id=1771101186666498
|
|
12
|
+
*/
|
|
13
|
+
import { IntegrationConfigBase } from '../analytics';
|
|
14
|
+
import { Integration } from './integration-manager';
|
|
15
|
+
declare global {
|
|
16
|
+
interface Window {
|
|
17
|
+
ttq?: Ttq;
|
|
18
|
+
TiktokAnalyticsObject?: string;
|
|
19
|
+
}
|
|
20
|
+
interface Ttq {
|
|
21
|
+
(...args: any[]): void;
|
|
22
|
+
methods?: string[];
|
|
23
|
+
_i?: Record<string, any>;
|
|
24
|
+
_t?: Record<string, number>;
|
|
25
|
+
_o?: Record<string, any>;
|
|
26
|
+
load?: (pixelId: string, options?: any) => void;
|
|
27
|
+
page?: () => void;
|
|
28
|
+
track?: (eventName: string, properties?: Record<string, unknown>) => void;
|
|
29
|
+
identify?: (properties?: Record<string, unknown>) => void;
|
|
30
|
+
setAndDefer?: (obj: any, method: string) => void;
|
|
31
|
+
instance?: (pixelId: string) => any;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export type TikTokEventMapping = {
|
|
35
|
+
[key: string]: StandardTikTokEvent;
|
|
36
|
+
};
|
|
37
|
+
export type TikTokPixelIntegrationConfig = IntegrationConfigBase & {
|
|
38
|
+
type: 'tiktok-pixel';
|
|
39
|
+
config: TikTokPixelConfig;
|
|
40
|
+
};
|
|
41
|
+
export type TikTokPixelConfig = {
|
|
42
|
+
pixelId: string;
|
|
43
|
+
eventMapping?: TikTokEventMapping;
|
|
44
|
+
testMode?: boolean;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Standard TikTok events supported by the pixel
|
|
48
|
+
*
|
|
49
|
+
* Note: This list reflects TikTok's official standard events. Events like 'CompletePayment'
|
|
50
|
+
* are not standard events and should be tracked as custom events if needed.
|
|
51
|
+
*
|
|
52
|
+
* Documentation: https://business-api.tiktok.com/portal/docs?id=1771101186666498
|
|
53
|
+
*/
|
|
54
|
+
export declare const standardTikTokEvents: readonly ["AddPaymentInfo", "AddToCart", "AddToWishlist", "ApplicationApproval", "CompleteRegistration", "Contact", "CustomizeProduct", "Download", "FindLocation", "InitiateCheckout", "Lead", "Purchase", "Schedule", "Search", "StartTrial", "SubmitApplication", "Subscribe", "ViewContent", "PageView"];
|
|
55
|
+
export type StandardTikTokEvent = (typeof standardTikTokEvents)[number];
|
|
56
|
+
/**
|
|
57
|
+
* Create a TikTok Pixel integration instance
|
|
58
|
+
*/
|
|
59
|
+
export declare function createTikTokPixelIntegration(config: TikTokPixelConfig): Integration;
|