SDK Installation

Install the Geddle SDK on your website to track affiliate referrals and conversions

Integrations2 min read

SDK Installation

Add the Geddle SDK to your website to track affiliate referrals.

Installation

  1. Go to Partner Dashboard → Products → Your Product
  2. Scroll to SDK Integration
  3. Copy the script tag
  4. Paste in your <head> or before </body>
<script async src="https://geddle.com/sdk/latest.js" data-product-id="YOUR_PRODUCT_ID" data-cookie-duration="60" ></script>

Configuration

<script async src="https://geddle.com/sdk/latest.js" data-product-id="prod_abc123" data-cookie-duration="60" data-attribution-model="last-click" ></script>

data-product-id (required): Your product ID from dashboard

data-cookie-duration (optional): Cookie lifetime in days. Default: 60

data-attribution-model (optional): last-click (default) or first-click

  • last-click: Most recent affiliate link gets commission
  • first-click: First affiliate link gets commission

Framework-Specific Installation

Next.js

Next.js provides built-in Script optimization that makes it easy to add the Geddle SDK with optimal loading performance.

App Router Installation

Add the SDK to your root layout for consistent tracking across all pages.

  1. Open your root layout file at app/layout.tsx (or app/layout.jsx)
  2. Import the Script component from next/script
  3. Add the Geddle SDK script with optimal loading strategy:
import Script from 'next/script' export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( <html lang='en'> <head> <Script async src='https://geddle.com/sdk/latest.js' data-product-id='YOUR_PRODUCT_ID' data-cookie-duration='60' strategy='afterInteractive' /> </head> <body>{children}</body> </html> ) }

Script Strategy Options

  • afterInteractive (recommended): Loads after the page is interactive
  • lazyOnload: Loads during idle time
  • beforeInteractive: Loads before page is interactive (use only if critical)

Verification

Go to Partner Dashboard → Products → Your Product → SDK Integration. It should show "SDK Script: Detected on website".

The SDK detects referral codes from ?ref=CODE, ?aff=CODE, ?via=CODE, or ?r=CODE and stores a tracking ID in the geddle_referral cookie (or localStorage if cookies are blocked).