User walks past a billboard · geofence fires · impression logged + coupon pushed
Events appear here as the scenario runs
import { createOxinion } from 'oxinion';
const oxinion = createOxinion({ apiKey: process.env.OXINION_API_KEY! });
// 1. Create a geofence around the DOOH screen
const { geofence } = await oxinion.geofencing.create({
name: "Times Sq Screen #4",
lat: 40.758,
lng: -73.985,
radius: 30, // tight 30m radius — must walk close
triggerType: "enter",
});
// 2. Create a pipeline: log impression → push coupon
const { pipeline } = await oxinion.pipeline.create({
name: "DOOH impression campaign",
geofenceId: geofence.id,
triggerEvent: "enter",
});
// Node 0 — log impression to your analytics endpoint
await oxinion.nodes.create({
pipelineId: pipeline.id,
type: "invoke",
orderIndex: 0,
config: {
target: "https://analytics.yourapp.com/impressions",
method: "POST",
body: { screenId: "screen_tsq_04", source: "oxinion" },
},
});
// Node 1 — push a coupon to the user's phone
await oxinion.nodes.create({
pipelineId: pipeline.id,
type: "notify",
orderIndex: 1,
config: {
userId: "{{userId}}",
title: "You just walked past our ad 👀",
body: "Scan this for 15% off — valid today only.",
data: { deepLink: "myapp://coupon/DOOH15" },
},
});
// 3. track() fires when the user is near the screen
await oxinion.track({
type: "enter",
lat: 40.758,
lng: -73.985,
userId: "user_123",
});