Websites
From the dashboard, you can navigate to different types of assets. Here we outline the features offered for websites.
Last updated
ALSDK.externalId = 'userid@mail.com' // Should use your internal user ID formatALSDK.postCustomEvent("Order Successful", "ORDERID-12345")<script async src="------ASK YOUR CSM FOR THE JS FILE URL------"></script>
<script>
window.ALSDK = window.ALSDK || {detectWallet:async()=>{return new Promise(async(resolve)=>{document.addEventListener('absolutelabs.walletDetected',(e)=>{resolve(e.detail)})})}};
ALSDK.siteId = 'YOUR PROJECT ID';
</script>const info = await ALSDK.detectWallet();
// returns { hasWallet: true, walletType: "MetaMask" }<head>
<script type="text/javascript">
ALSDK.detectWallet().then(w => {
if (w.hasWallet === true) {
document.body.classList.add('has-wallet')
document.querySelector('.wallet-detected').innerText = w.walletType
}
})
</script>
<style type="text/css">
.wallet-only { display: none }
body.has-wallet .wallet-only { display: block }
</style>
..
</head>
<body>
..
<p class="wallet-only">
This message is visible because you have a wallet in your browser.
Wallet detected: <span class="wallet-detected"></span>
</p>window.addEventListener('ALSDK.ready', function () {
// Check if there is a connected wallet, and if it is in a given Absolute Labs Segment
ALSDK.isInSegment('TEAM:SEGMENT_ID') // put your team & segment IDs here
.then(response => {
if (response.result) {
alert('wallet is in segment')
} else {
alert('wallet is not in segment')
}
});
});