DeFiKit's Solana wallet tracking infrastructure can power a marketing analytics dashboard that measures campaign attribution by wallet activity. By mapping wallet addresses to campaign touchpoints and monitoring on-chain behavior before and after engagement, you get verifiable ROI data — not channel-touch guesses.
The Problem: Crypto Marketing Has No Reliable Attribution
Crypto marketing operates in a blind spot. You launch a Twitter campaign, run a Discord airdrop, sponsor a newsletter — and at the end of the month you have vanity metrics: impressions, clicks, maybe some wallet connections. What you cannot answer is the critical question: Did that tweet actually drive a trade?
Traditional attribution models break down in crypto for three reasons. Pseudonymous wallets kill identity stitching — Google Analytics sees a landing page hit, Solana sees a wallet address signing transactions, and those views never meet. Channel-touch attribution relies on cookies and UTMs that users clear regularly, especially in privacy-conscious crypto audiences. And there is no bridge connecting marketing spend to on-chain action: the marketing team burns Solana on ads while the product team watches wallet dashboards, and nobody connects the two.
A typical project burns $50,000–$200,000 per month on marketing with no way to prove which channels actually produce swaps, deposits, or mints. Budgets are allocated by intuition rather than data.
The Solution: DeFiKit's Scanner as Attribution Infrastructure
DeFiKit's Solana scanner already does the hard work: it watches wallet addresses in real time, indexes every transaction, and surfaces token swaps, LP deposits, NFT purchases, and protocol interactions. That same infrastructure — with one extension — becomes a marketing attribution engine.
The key insight is simple: tag wallets by campaign source at the moment of connection, then use DeFiKit's scanner to observe everything those wallets do afterward. When a user connects their wallet in response to a campaign, you record `wallet_address → campaign_id → timestamp`. From that point forward, every swap, deposit, and interaction is automatically attributed to the originating campaign.
This gives you four capabilities traditional analytics cannot touch: campaign-level conversion funnels, time-to-first-action analysis, lifetime value comparisons by source channel, and cost-per-acquisition in Solana.
Architecture: D1 + Solana Scanner + Cloudflare Workers
The dashboard runs on a three-layer stack combining serverless storage, real-time blockchain scanning, and edge API delivery.
**Layer one: D1 database for campaign-wallet mappings.** Cloudflare's D1 stores the attribution graph. Two tables do the work:
```sql
CREATE TABLE campaign_attributions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
campaign_id TEXT NOT NULL,
wallet_address TEXT NOT NULL,
connected_at INTEGER NOT NULL,
source_channel TEXT,
utm_params TEXT,
UNIQUE(wallet_address, campaign_id)
);
CREATE TABLE campaign_events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
wallet_address TEXT NOT NULL,
event_type TEXT NOT NULL,
tx_signature TEXT NOT NULL,
token_amount REAL,
usd_value REAL,
timestamp INTEGER NOT NULL
);
```
A unique constraint prevents double-counting — if the same wallet connects through two campaigns, the first touchpoint is preserved.
**Layer two: DeFiKit's Solana scanner for on-chain activity.** The scanner runs as a Cloudflare Worker triggered on a cron schedule. For each wallet in `campaign_attributions`, it pulls recent transactions, parses instruction data, and inserts events into `campaign_events`.
```javascript
async function scanCampaignWallets(env) {
const wallets = await env.DB.prepare(
'SELECT DISTINCT wallet_address FROM campaign_attributions'
).all();
for (const { wallet_address } of wallets.results) {
const txns = await fetchDeFiKitTransactions(wallet_address);
for (const tx of txns) {
await env.DB.prepare(
`INSERT OR IGNORE INTO campaign_events
(wallet_address, event_type, tx_signature, token_amount, usd_value, timestamp)
VALUES (?, ?, ?, ?, ?, ?)`
).bind(
wallet_address, tx.type, tx.signature,
tx.tokenAmount, tx.usdValue, tx.blockTime
).run();
}
}
}
```
**Layer three: Cloudflare Workers API for the dashboard.** A read-only Workers API serves aggregated data to a frontend dashboard, running pre-computed queries against D1.
Implementation: SQL Queries for Campaign Attribution
With the architecture in place, you can answer specific marketing questions with straightforward SQL.
**New wallet creation attribution.** Compare wallets created before versus after a campaign start date:
```sql
SELECT
campaign_id,
COUNT(*) AS total_wallets,
SUM(CASE WHEN wallet_age_days < 1 THEN 1 ELSE 0 END) AS new_wallets,
ROUND(AVG(wallet_age_days), 1) AS avg_wallet_age_days
FROM (
SELECT
ca.campaign_id,
ca.connected_at,
(ca.connected_at - MIN(ce.timestamp)) / 86400.0 AS wallet_age_days
FROM campaign_attributions ca
LEFT JOIN campaign_events ce ON ca.wallet_address = ce.wallet_address
GROUP BY ca.id
)
GROUP BY campaign_id;
```
This reveals which campaigns drive genuinely new users versus reactivating existing wallets.
**Conversion funnel by campaign.** The classic AARRR funnel adapted for DeFi:
```sql
SELECT
ca.campaign_id,
COUNT(DISTINCT ca.wallet_address) AS connected,
COUNT(DISTINCT CASE WHEN swap.tx_signature IS NOT NULL THEN ca.wallet_address END) AS swapped,
COUNT(DISTINCT CASE WHEN deposit.tx_signature IS NOT NULL THEN ca.wallet_address END) AS deposited,
ROUND(100.0 * COUNT(DISTINCT CASE WHEN swap.tx_signature IS NOT NULL THEN ca.wallet_address END)
/ COUNT(DISTINCT ca.wallet_address), 1) AS conversion_pct
FROM campaign_attributions ca
LEFT JOIN campaign_events swap
ON ca.wallet_address = swap.wallet_address AND swap.event_type = 'swap'
LEFT JOIN campaign_events deposit
ON ca.wallet_address = deposit.wallet_address AND deposit.event_type = 'deposit'
GROUP BY ca.campaign_id;
```
**ROI calculation per campaign.** The metric that matters most:
```sql
SELECT
ca.campaign_id,
ca.source_channel,
c.cost_sol,
COUNT(DISTINCT ca.wallet_address) AS wallets,
COALESCE(SUM(ce.usd_value), 0) AS total_volume_usd,
CASE WHEN c.cost_sol > 0
THEN COALESCE(SUM(ce.usd_value), 0) / (c.cost_sol * :sol_price)
ELSE NULL
END AS roi_multiple,
CASE WHEN COUNT(DISTINCT ca.wallet_address) > 0
THEN c.cost_sol / COUNT(DISTINCT ca.wallet_address)
ELSE NULL
END AS cpa_sol
FROM campaign_attributions ca
JOIN campaigns c ON ca.campaign_id = c.campaign_id
LEFT JOIN campaign_events ce ON ca.wallet_address = ce.wallet_address
GROUP BY ca.campaign_id;
```
**Retention cohorts.** Do wallets from certain channels stick around longer?
```sql
SELECT
ca.source_channel,
DATE(ca.connected_at, 'unixepoch') AS cohort_week,
COUNT(DISTINCT ca.wallet_address) AS week_0,
COUNT(DISTINCT CASE WHEN ce.timestamp >= ca.connected_at + 604800 THEN ca.wallet_address END) AS week_1,
COUNT(DISTINCT CASE WHEN ce.timestamp >= ca.connected_at + 1209600 THEN ca.wallet_address END) AS week_2
FROM campaign_attributions ca
LEFT JOIN campaign_events ce ON ca.wallet_address = ce.wallet_address
GROUP BY ca.source_channel, cohort_week
ORDER BY cohort_week;
```
Results: From Guesswork to Verifiable On-Chain Data
A Solana DeFi protocol deployed this system across three months and five marketing channels. The results validated the approach with hard numbers.
**Campaign attribution accuracy jumped from zero to 100% verifiable.** Before the dashboard, the team relied on UTM-tagged landing pages and self-reported connections. After deployment, every on-chain action rolled up to a specific campaign, wallet, and timestamp. No guesses, no surveys, no modeled attribution.
**CPA dropped by 35% within 60 days.** The dashboard revealed that two channels — a niche DeFi newsletter and a targeted Discord airdrop — produced 70% of all converting wallets while consuming only 40% of the budget. The team reallocated spend away from broad influencer campaigns that generated impressions but negligible swap volume. Cost per acquiring wallet fell from 4.2 SOL to 2.7 SOL.
**Retention insights reshaped campaign design.** The cohort analysis showed wallets acquired through educational content had a week-2 retention rate of 38%, compared to 14% for giveaway-attributed wallets. The team shifted creative strategy toward utility-focused messaging.
**Marketing efficiency improved by 58%.** Underperforming campaigns were paused mid-flight rather than burning budget for the full month. Total volume generated per SOL spent rose sharply across the three-month period.
Key Takeaways
**On-chain data is the only source of truth for crypto marketing.** Everything else — impressions, clicks, DAU counts — is a proxy. Wallet activity is a signal that cannot be faked, and DeFiKit's infrastructure makes it accessible without running your own Solana RPC nodes.
**Start simple.** One D1 table for wallet-campaign mappings, one scanner worker, and a handful of SQL queries give you more attribution accuracy than most marketing stacks running on Web2 analytics platforms.
**Attribution changes budget decisions immediately.** The first time you see Channel A costs 1.2 SOL per swap while Channel B costs 8.7 SOL, you reallocate spend without needing a board presentation.
**Privacy and compliance matter.** Wallet addresses are pseudonymous, not anonymous. Use hashed identifiers where possible, implement data retention policies, and be transparent with users about on-chain tracking in your terms of service.
**Crypto marketing is finally measurable.** For years, the industry accepted that marketing was a black box funded by token treasuries with no accountability. DeFiKit's scanner, extended with a campaign attribution layer, closes that gap. You can measure what matters, prove what works, and stop spending on what does not.