Attribute revenue with Lovable
Make sure you've added DataFast tracking to your Lovable site and connected your Stripe account first.
Copy and paste this prompt to your Lovable AI assistant to automatically set up revenue attribution:
Prompt for Lovable:
I need to add DataFast revenue attribution tracking to my Stripe payment integration. I don't know which Stripe method is currently implemented, so please detect the current setup and implement the appropriate solution. Here are the 4 possible implementations based on what's currently in the code: METHOD 1 - If using Stripe Payment Links: If you find Stripe Payment Links being used, tell me to follow this guide instead: https://datafa.st/docs/stripe-payment-links (this requires configuration in the Stripe dashboard, not code changes) METHOD 2 - If using Stripe Checkout API (stripe.checkout.sessions.create): Add DataFast tracking cookies to the checkout session metadata: 1. Get the 'datafast_visitor_id' and 'datafast_session_id' cookies from the request 2. Add them to the checkout session metadata: metadata: { datafast_visitor_id: cookieValue1, datafast_session_id: cookieValue2 } See full documentation: https://datafa.st/docs/stripe-checkout-api METHOD 3 - If using Stripe PaymentIntent API (stripe.paymentIntents.create): Add DataFast tracking cookies to the PaymentIntent metadata: 1. Get the 'datafast_visitor_id' and 'datafast_session_id' cookies from the request 2. Add them to the PaymentIntent metadata: metadata: { datafast_visitor_id: cookieValue1, datafast_session_id: cookieValue2 } See full documentation: https://datafa.st/docs/stripe-payment-intent-api METHOD 4 - If using any other Stripe method or unsure: Add client-side tracking on the payment success page: window.datafast("payment", { email: customerEmail }); Replace 'customerEmail' with the actual customer's email. See full documentation: https://datafa.st/docs/stripe-other-methods Please: 1. Examine the current payment code to determine which method is being used 2. Implement the appropriate solution above 3. Let me know which method you implemented
After implementing revenue attribution, you should see payment data in your DataFast dashboard with full visitor attribution. If you need help, contact us at marc@datafa.st.