@onelastclick/react
v0.1.6
Published
React component to embed One Last Click interactive ads in any website
Maintainers
Readme
@onelastclick/react
Drop One Last Click interactive ads into any React app with two props.
Install
npm install @onelastclick/reactUsage
- Sign up as a publisher on One Last Click
- Open Websites, enter your host URL (e.g.
https://myapp.com) - Copy the unique ID and pass it as
publisherId
import { Ad } from "@onelastclick/react";
<Ad type="in-chat" publisherId="YOUR_SITE_ID" />
<Ad type="vertical" publisherId="YOUR_SITE_ID" />
<Ad type="horizontal" publisherId="YOUR_SITE_ID" />Ads load only when:
- the
publisherIdis valid, and - the page is on the website domain you registered
Otherwise the component shows an error.
Optional props
| Prop | Description |
|------|-------------|
| context | { question, answer } for relevance matching in chat |
| placement | Placement key from your dashboard |
| endpoint | API origin (default https://onelastclick.dev) |
| onTransaction | Fired when a widget checkout completes |
| onAbandon | Fired when the user leaves mid-flow |
<Ad
type="in-chat"
publisherId={process.env.NEXT_PUBLIC_OLC_PUBLISHER_ID!}
context={{ question, answer }}
onTransaction={(detail) => console.log("sale", detail)}
/>Local development
Until production is deployed, you must point endpoint at your running One Last Click app
(Vite defaults to port 5173):
<Ad
type="vertical"
publisherId="YOUR_SITE_ID"
endpoint="http://localhost:5173"
/>Also register localhost (or your publisher site’s host) under Websites so domain checks pass.
Formats
| type | Size | Best for |
|--------|------|----------|
| in-chat | Fluid · up to 560px | AI chat replies |
| vertical | 300×600 | Sidebars / tall placements |
| horizontal | 728×250 | Headers / wide rails |
Square placements are not supported.
License
MIT
