Skip to content

Commit

Permalink
safary tag
Browse files Browse the repository at this point in the history
  • Loading branch information
mikestarrdev committed Aug 7, 2024
1 parent dc1d0c9 commit 231a4ab
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
gtag('js', new Date());
gtag('config', 'G-XSB2E7X42G');
</script>
<!-- Safary tracking pixel -->
<script>var script=document.createElement('script');script.src="https://tag.safary.club/stag-0.1.11.js";script.async=true;script.setAttribute('data-name','safary-sdk');script.setAttribute('data-product-id','prd_sqDPUgjosS');script.integrity="sha256-FcvJgRCaJFszFBKv8MGIbUcmHlVuHp7LX8zGgjfvvGs=";script.crossOrigin="anonymous";var target=document.head||document.body;target.appendChild(script);</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
1 change: 1 addition & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export {};
declare global {
interface Window {
Buffer: any;
safary: any;
}
}
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<React.StrictMode>
Expand Down
30 changes: 30 additions & 0 deletions src/tracking/safaryTracking.ts
Original file line number Diff line number Diff line change
@@ -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");
}
};

0 comments on commit 231a4ab

Please sign in to comment.