Skip to main content

Overview

This guide will get you tracking user behavior and wallet connections in about 5 minutes. By the end, you’ll have:
  • ✅ Automatic page, click, scroll, and form signals (when auto-events="true")
  • ✅ Session tracking via the SDK session model
  • ✅ Wallet linking with Cryptique.walletAddress() (and optional custom events)
  • ✅ Data flowing to your dashboard

Prerequisites

  • A Cryptique account (sign up here)
  • Access to your website’s HTML or build system
  • Your Site ID from the Cryptique dashboard

Step 1: Get Your Site ID

  1. Log in to app.cryptique.io
  2. Navigate to Settings → Sites
  3. Click Add Site or select an existing site
  4. Copy your Site ID (format: your-domain-xx)

Step 2: Add the Tracking Script

Choose your installation method:

Step 3: Verify Installation

  1. Visit your website
  2. Open your browser’s developer console (F12)
  3. Look for: [Cryptique] Initialized successfully
  4. Go to your Cryptique dashboard → Live Events
  5. You should see events appearing in real-time
Events may take up to 60 seconds to appear in the dashboard. If you don’t see events after 2 minutes, check the troubleshooting guide.

Step 4: Track Custom Events

Beyond auto-events, track specific actions that matter to your product:
// Track a custom event
Cryptique.track('swap_initiated', {
  input_token: 'ETH',
  output_token: 'USDC',
  amount: 1.5
});

Step 5: Track Wallet Connections

When a user connects their wallet:
// After wallet connection (e.g., via wagmi, ethers, web3-react)
Cryptique.walletAddress(walletAddress);
If you’re using standard wallet libraries, Cryptique can auto-detect wallet connections. Enable with:
<script>
  var script = document.createElement('script');
  script.src = 'https://cdn.cryptique.io/scripts/analytics/1.0.1/cryptique.script.min.js';  
  script.setAttribute('site-id', 'YOUR_SITE_ID');
  script.setAttribute('auto-events', 'true');
  script.setAttribute('auto-wallet-detect', 'true');
  document.head.appendChild(script);
</script>

Step 6: Identify Users

When a user logs in or you know their identity:
Cryptique.identify('user_12345');

// Set user properties
Cryptique.people.set({
  email: 'user@example.com',
  plan: 'pro',
  signup_date: '2024-01-15'
});
This links all their past anonymous activity to their identified profile.

What’s Being Tracked?

With auto-events enabled, the SDK sends many named auto events. Common ones:
EventDescription
page_viewPage load / route with timing context
element_clickClicks with element and coordinate metadata
rage_click / dead_clickFrustration and non-interactive click patterns
page_scrollIncreasing scroll depth
form_submitForm submits (metadata only, no field values)
text_selection / copy_actionSelection and copy signals
page_summaryAggregated engagement when the user leaves or hides the tab
See the full list in Auto-Events. Wallet connect/disconnect are not built-in auto events — use Cryptique.walletAddress() and Cryptique.track() if you want them in the event stream.

Example: Complete Setup

Here’s a complete example for a DeFi app:
<!DOCTYPE html>
<html>
<head>
  <title>My DeFi App</title>
  
  <!-- Cryptique Tracking -->
  <script>
    var script = document.createElement('script');
    script.src = 'https://cdn.cryptique.io/scripts/analytics/1.0.1/cryptique.script.min.js';  
    script.setAttribute('site-id', 'mydefi-app-42');
    script.setAttribute('auto-events', 'true');
    document.head.appendChild(script);
  </script>
</head>
<body>
  <!-- Your app content -->
  
  <script>
    // Track custom events when they happen
    function onSwapComplete(txHash, inputToken, outputToken, amount) {
      Cryptique.track('swap_completed', {
        transaction_hash: txHash,
        input_token: inputToken,
        output_token: outputToken,
        amount_usd: amount
      });
    }
    
    // Track wallet connection
    async function connectWallet() {
      const accounts = await ethereum.request({ 
        method: 'eth_requestAccounts' 
      });
      
      Cryptique.walletAddress(accounts[0]);
      Cryptique.track('wallet_connected', {
        wallet_type: 'metamask',
        chain_id: await ethereum.request({ method: 'eth_chainId' })
      });
    }
  </script>
</body>
</html>

Troubleshooting

  1. Check browser console for errors
  2. Verify your Site ID is correct
  3. Ensure the script loads before user interactions
  4. Check that your domain is allowed in site settings
  5. Disable ad blockers temporarily
  1. Check for Content Security Policy (CSP) blocks
  2. Verify the CDN URL is correct
  3. Try the npm package instead
  1. Call Cryptique.walletAddress(address) after the wallet connects
  2. Pass a valid address (0x…)
  3. If you rely on a custom event (e.g. wallet_connected), call Cryptique.track() yourself — it is not emitted automatically

Next Steps

Add Smart Contracts

Track on-chain transactions

Enable Wallet Enrichment

Get rich user profiles

Build Your First Report

Create insights from your data

SDK Reference

Full SDK documentation