diff --git a/public/index.html b/public/index.html index 718bf6e2..477deb88 100644 --- a/public/index.html +++ b/public/index.html @@ -39,6 +39,8 @@ gtag('js', new Date()); gtag('config', 'G-XSB2E7X42G'); + + diff --git a/src/global.d.ts b/src/global.d.ts index 719cfe4d..4c730929 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -3,5 +3,6 @@ export {}; declare global { interface Window { Buffer: any; + safary: any; } } diff --git a/src/index.tsx b/src/index.tsx index 32a6ea82..1c518235 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -7,8 +7,10 @@ import * as buffer from "buffer"; import App from "./App"; import { store } from "./app/store"; import * as serviceWorker from "./serviceWorker"; +import { safaryTracking } from '../src/tracking/safaryTracking'; window.Buffer = buffer.Buffer; +safaryTracking() ReactDOM.render( diff --git a/src/tracking/safaryTracking.ts b/src/tracking/safaryTracking.ts new file mode 100644 index 00000000..a6414f13 --- /dev/null +++ b/src/tracking/safaryTracking.ts @@ -0,0 +1,30 @@ +export const safaryTracking = () => { + if (window.safary) { + window.safary.track({ + eventType: "swap", + eventName: "swaps-main", + parameters: { + walletAddress: "0x9999999999999", + fromAmount: 0.001, + fromCurrency: "ETH", + contractAddress: "0x000000000000", + } + }); + + window.safary.track({ + eventType: "swap", + eventName: "swaps-OTC", + parameters: { + fromAmount: 0.001, + fromCurrency: "ETH", + fromAmountUSD: 1.8, + contractAddress: "0x000000000000", + toAmount: 0.000045, + toCurrency: "USDT", + toAmountUSD: 1.73, + } + }); + } else { + console.error("Safary SDK is not loaded"); + } +};