Recognising returning visitors
Fill your ad slot even when the visitor hasn't connected a wallet.
Most dapp visitors sometimes have a wallet connected and sometimes don't, especially when they come back after a while. Without a wallet there's nothing to match an ad against, so those visits show no ads.
With the visitor's consent, Specify can recognise them anyway, which greatly increases how many of your visitors see ads. It only applies in the browser; the Node.js SDK always needs wallet addresses.
1. Connect your consent banner
Pass your consent manager's answer for targeted advertising as early as you can on every page load, then again whenever it changes. The SDK never stores it, so your consent tool stays the source of truth.
import { specify } from './lib/specify';
// Adapt this code to your cookie consent management tool
specify.setCookieConsent(cmp.getConsent().targetedAdvertising);
cmp.onConsentChange((consent) => {
specify.setCookieConsent(consent.targetedAdvertising);
});Set it before your first serve(), or a visitor without a wallet can't be recognised. Most consent tools hand back a returning visitor's stored answer immediately; use that rather than waiting for the banner.
2. Serve without a wallet
With consent, a serve with no address can still fill. Pass null when there's no wallet, so one call covers both cases:
import { ImageFormat } from '@specify-sh/publisher-sdk';
import { specify } from './lib/specify';
const ad = await specify.serve(getConnectedWallet() ?? null, {
imageFormat: ImageFormat.LONG_BANNER,
adUnitId: 'article-footer'
});
if (ad) render(ad);If the placement has no address in scope at all, drop the first argument: serve({ imageFormat }).
3. Keep passing wallets
Recognition fills the gap when there's no wallet; it doesn't replace wallets. Register each wallet when it connects, and every later serve includes it:
import { specify } from './lib/specify';
onWalletConnect((address: `0x${string}`) => specify.identify(address));On privacy
Specify sets one cookie, on its own domain, and only with consent. Without consent it neither reads nor sets it, and ads still serve against the wallets you pass. We don't use browser fingerprinting.