Skip to Content
Getting StartedQuick Start

Quick Start

Follow the steps below to initialize the SDK, render your first widget, and enable instant checkout on your target platform.

Make sure you have installed the SDK and configured authentication before proceeding.

1. Initialize the SDK

import { ProductAdsProvider } from "@nohi/product-ads-sdk"; export function AppProviders({ children }: { children: React.ReactNode }) { return ( <ProductAdsProvider apiKey={process.env.PRODUCT_ADS_API_KEY!} environment="production" appId="web-storefront" locale="en-US" currency="USD" onEvent={(event) => { console.log("product-ads event", event); }} > {children} </ProductAdsProvider> ); }

2. Render a Conversational Advertisement Widget

import { ConversationalAdWidget } from "@nohi/product-ads-sdk"; export function HomepagePlacement() { return ( <ConversationalAdWidget placementId="home-hero-sponsored" context={{ pageType: "home", sessionId: "session_123", customerSegment: "new-user", }} mode="redirect" /> ); }

3. Enable Instant Checkout

import { ConversationalAdWidget } from "@nohi/product-ads-sdk"; export function ProductUpsellPlacement() { return ( <ConversationalAdWidget placementId="pdp-upsell-sponsored" context={{ pageType: "product", productId: "prod_123", }} mode="instant-checkout" checkoutOptions={{ presentation: "sheet", }} /> ); }

Next Steps

Last updated on