@bigz-app/booking-widget 0.2.3 → 0.3.1
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 +28 -2
- package/dist/booking-widget.js +397 -76
- package/dist/booking-widget.js.map +1 -1
- package/dist/components/BookingForm.d.ts.map +1 -1
- package/dist/components/BookingSuccessModal.d.ts.map +1 -1
- package/dist/components/EventInstanceSelection.d.ts +0 -1
- package/dist/components/EventInstanceSelection.d.ts.map +1 -1
- package/dist/components/PaymentForm.d.ts.map +1 -1
- package/dist/components/UniversalBookingWidget.d.ts +21 -0
- package/dist/components/UniversalBookingWidget.d.ts.map +1 -1
- package/dist/index.cjs +397 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +397 -76
- package/dist/index.esm.js.map +1 -1
- package/dist/utils/google-ads-tracking.d.ts +65 -0
- package/dist/utils/google-ads-tracking.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Ads Conversion Tracking Utility
|
|
3
|
+
*
|
|
4
|
+
* This utility handles Google Ads conversion tracking for the booking widget.
|
|
5
|
+
* It includes consent checking, gtag initialization, and conversion tracking.
|
|
6
|
+
*/
|
|
7
|
+
export interface GoogleAdsConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Google Ads Tag ID (e.g., 'AW-XXXXXXX')
|
|
10
|
+
*/
|
|
11
|
+
tagId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Google Ads Conversion ID/Label (e.g., 'booking_conversion')
|
|
14
|
+
*/
|
|
15
|
+
conversionId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional conversion value for the booking
|
|
18
|
+
*/
|
|
19
|
+
conversionValue?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Optional conversion currency (defaults to 'EUR')
|
|
22
|
+
*/
|
|
23
|
+
conversionCurrency?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional transaction ID for deduplication
|
|
26
|
+
*/
|
|
27
|
+
transactionId?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Interface for Google Consent Mode state
|
|
31
|
+
*/
|
|
32
|
+
export interface ConsentData {
|
|
33
|
+
ad_storage?: "granted" | "denied";
|
|
34
|
+
analytics_storage?: "granted" | "denied";
|
|
35
|
+
functionality_storage?: "granted" | "denied";
|
|
36
|
+
personalization_storage?: "granted" | "denied";
|
|
37
|
+
security_storage?: "granted" | "denied";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check if Google Consent Mode has granted the necessary permissions for ads tracking
|
|
41
|
+
* This only checks Google's official consent mode - the proper way to handle Google Ads consent
|
|
42
|
+
*/
|
|
43
|
+
export declare function checkGoogleConsent(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Check if gtag is already initialized on the host page
|
|
46
|
+
*/
|
|
47
|
+
export declare function isGtagInitialized(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Initialize Google Tag (gtag) if not already present
|
|
50
|
+
*/
|
|
51
|
+
export declare function initializeGtag(tagId: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Track a Google Ads conversion
|
|
54
|
+
*/
|
|
55
|
+
export declare function trackConversion(config: GoogleAdsConfig): void;
|
|
56
|
+
/**
|
|
57
|
+
* Main function to handle Google Ads conversion tracking
|
|
58
|
+
* This function checks consent, initializes gtag if needed, and tracks the conversion
|
|
59
|
+
*/
|
|
60
|
+
export declare function handleGoogleAdsConversion(config: GoogleAdsConfig): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Utility function to get conversion value from booking data
|
|
63
|
+
*/
|
|
64
|
+
export declare function getConversionValueFromBooking(bookingData: any): number | undefined;
|
|
65
|
+
//# sourceMappingURL=google-ads-tracking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-ads-tracking.d.ts","sourceRoot":"","sources":["../../src/utils/google-ads-tracking.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,iBAAiB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACzC,qBAAqB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7C,uBAAuB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/C,gBAAgB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAqC5C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CA0B3C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqE3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAiE7D;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CtF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAiClF"}
|