'use client'; import { useState } from 'react'; export default function Home() { const [loading, setLoading] = useState(false); const getCookie = (name: string): string | null => { const value = `; ${document.cookie}`; const parts = value.split(`; ${name}=`); if (parts.length === 2) return parts.pop()?.split(';').shift() || null; return null; }; const startCheckout = async () => { setLoading(true); const visitorId = getCookie('datafast_visitor_id'); console.log('DataFast Visitor ID:', visitorId); try { const response = await fetch('/api/checkout', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ visitorId }) }); const data = await response.json(); console.log('Checkout response:', data); if (data.checkoutUrl) { window.location.href = data.checkoutUrl; } } catch (error) { console.error('Error:', error); alert('Failed to create checkout'); } finally { setLoading(false); } }; return (

CREEM + DataFast Integration (Next.js)

This example demonstrates automatic revenue attribution between CREEM and DataFast.

How it works:
  • DataFast visitor ID is automatically captured from cookies
  • When checkout completes, payment data is sent to DataFast
  • Revenue is attributed to the correct traffic source

Product: Premium Plan | Check console for debug info

); }