@heymike/ads-web
v0.1.1
Published
Web React components + vanilla helper for the heymike-ads cross-marketing SDK.
Readme
@heymike/ads-web
Web banner components + a vanilla helper for the
heymike-ads cross-marketing SDK. Re-exports
everything from @heymike/ads-core.
npm install @heymike/ads-web reactReact
import { createAdClient, AdBanner, AdPopup } from '@heymike/ads-web';
import { useMemo, useState } from 'react';
export function Sidebar() {
const client = useMemo(
() => createAdClient({ app: 'example.com' }),
[],
);
const [open, setOpen] = useState(false);
return (
<>
<AdBanner client={client} bannerType="square" />
<button onClick={() => setOpen(true)}>Show popup</button>
<AdPopup client={client} open={open} onClose={() => setOpen(false)} />
</>
);
}<AdBanner client bannerType />— inline tracked banner (renders nothing if no ad).<AdPopup client open onClose bannerType? />— modal popup (square by default).
Impressions fire via a 1×1 pixel; clicks go through the server's tracked redirect.
Vanilla (no framework)
import { createAdClient, mount } from '@heymike/ads-web';
const client = createAdClient({ app: 'example.com' });
const unmount = await mount('#ad-slot', { client, bannerType: 'banner' });
// call unmount() to remove itLicense
MIT
