For B2B SaaS companies running paid ads, one of the most persistent challenges is connecting ad spend to actual revenue. You can see clicks, leads, and trials in your ad dashboards, but the question that matters most often goes unanswered: which campaigns are generating paying customers?
Stripe revenue attribution closes that gap. By linking your Stripe payment data to your marketing touchpoints, you can see exactly which ads, channels, and campaigns drove real revenue, not just form fills or signups.
This guide walks through the complete setup process for connecting Stripe to a marketing attribution platform like Cometly. You will learn how to configure your Stripe account, pass the right data at each stage of the customer journey, and verify that revenue events are flowing accurately into your attribution reports.
Whether you are a marketing leader trying to justify ad spend or a growth operator optimizing for pipeline efficiency, this setup gives you a single source of truth that ties every dollar of revenue back to the campaign that earned it.
By the end of this guide, you will have a working Stripe revenue attribution setup that connects closed revenue to first and last touch marketing data, enabling smarter budget decisions and more confident scaling.
Step 1: Gather Your Prerequisites and Access Requirements
Before you touch a single integration setting, take stock of what you actually have in place. Rushing into a Stripe revenue attribution setup without the right access and data structure is one of the most common reasons teams end up with broken attribution weeks later.
Here is what you need before starting:
Admin access to Stripe: You will need permission to view API keys, configure webhooks, and add metadata fields to customer and subscription objects. A restricted API key with read-only access to charges, customers, and subscriptions is the right security approach here.
Access to your attribution platform: You need admin or developer-level access to Cometly to install the tracking pixel, configure integrations, and set up event mappings.
Developer or no-code access to your product: At minimum, you need the ability to modify your signup flow so you can pass user identifiers to Cometly and add metadata to Stripe customer objects at account creation.
Next, identify which Stripe events actually matter for B2B SaaS attribution. Not every Stripe event carries revenue significance. The ones you want to prioritize are:
customer.subscription.created: This signals a new paying customer and is the primary conversion event for subscription businesses.
invoice.paid: This confirms recurring revenue and is essential for tracking MRR and LTV by channel.
charge.succeeded: Relevant for one-time payments or setup fees, depending on your pricing model.
customer.subscription.updated: Useful for tracking upgrades or plan changes that affect revenue attribution downstream.
Confirm that your attribution platform supports Stripe as a native integration or via webhook, and verify that it handles both one-time payments and recurring subscription revenue. Some platforms only capture the initial conversion and miss renewal events entirely, which significantly understates the revenue value of a campaign.
Finally, check whether your CRM or product database stores a shared user identifier, typically email address or an internal customer ID, that can be matched across both Stripe and your marketing data. This identifier is the linchpin of the entire setup.
The most common pitfall at this stage is skipping the identifier audit. If your product assigns internal user IDs that differ from the email stored in Stripe, you will face mismatched records downstream and attribution gaps that are difficult to trace back to their source.
Step 2: Install the Cometly Tracking Pixel and Identify Users Early
Here is the core principle behind Stripe revenue attribution: it only works if the person who clicked your ad can be matched to the customer who paid in Stripe. That match has to be established early in the journey, ideally at the moment of signup, not at the point of payment.
This is why pixel installation and early user identification are the foundation of everything that follows.
Start by installing the Cometly tracking pixel on your marketing site and your product's signup flow. The pixel captures the original ad click, assigns a visitor ID, and begins tracking the session from the first touchpoint. Without this, you have no record of which ad or channel brought the user to your site in the first place.
The critical next step happens at signup or trial creation. At that moment, pass the user's email address or unique internal ID to Cometly using an identify call. This links the anonymous visitor session, which carries the ad click data, to a known user record. From this point forward, Cometly can follow that user through your funnel and match any future Stripe events back to their original marketing source.
Think of it this way: the identify call is the bridge between your ad data and your revenue data. Without it, those two datasets remain separate, and attribution becomes guesswork.
Here is what the identify call should include at a minimum:
Email address: The same email the user provided at signup, which should also be stored on their Stripe customer object.
User ID: Your internal system-generated identifier, if your product uses one, so you have a fallback match key beyond email.
Signup timestamp: Useful for debugging attribution timing issues later.
The most common mistake at this stage is delaying identification until after payment. If your identify call only fires when a user completes a Stripe checkout, you lose the ability to match that charge back to the ad click that started the journey. By the time payment happens, the original session data may have expired or been overwritten.
To confirm this step is working correctly, check Cometly's customer journey view after a test signup. You should see a named user with their original traffic source, campaign, and ad data attached before any payment event fires. If you see an anonymous visitor converting to a paid customer with no marketing source attached, your identification timing needs to be moved earlier in the flow.
Step 3: Connect Stripe to Your Attribution Platform
With your pixel installed and user identification in place, you are ready to connect Stripe directly to Cometly. This is where your payment data starts flowing into your attribution reports.
Navigate to Cometly's integrations panel and select the Stripe integration. The connection process will prompt you for your Stripe API key. Use a restricted key rather than your full secret key. Configure it with read-only access to charges, customers, and subscriptions. This follows security best practices and limits the blast radius if the key is ever exposed.
Once authenticated, select which Stripe events to sync. For B2B SaaS, your priorities should be:
1. customer.subscription.created for new paying customer attribution
2. invoice.paid for recurring revenue tracking across the customer lifecycle
3. charge.succeeded for any one-time payment events in your pricing model
Next, configure the revenue mapping. This tells Cometly which Stripe fields represent the revenue amount, currency, and customer identifier to use for matching. Typically this means mapping the amount field on the charge or invoice object to your revenue metric, and the customer field to the identifier you are using for cross-system matching.
If Cometly does not have a native Stripe integration in your current plan, or if you need more granular control, you can set up a webhook directly in Stripe. Navigate to Stripe's developer settings, create a new webhook endpoint pointing to Cometly's event ingestion URL, and select the specific events you want to forward. This approach gives you flexibility but requires more manual configuration of the event payload mapping on the Cometly side.
After completing the connection, trigger a test event. In Stripe's developer dashboard, you can send a test webhook for any event type. That test event should appear in Cometly's event log within a few minutes. If it does not appear, check that your API key has the correct permissions and that the webhook endpoint URL is correctly formatted.
A successful connection at this stage means Stripe payment events are arriving in Cometly and are being logged with the correct revenue amounts and customer identifiers. The matching to marketing touchpoints happens in the next step.
Step 4: Map Stripe Customer Data to Marketing Touchpoints
This is the step where attribution either works or falls apart. You have Stripe events flowing into Cometly and visitor sessions tracked from ad clicks. Now you need a reliable way to join those two datasets.
The matching logic is straightforward in concept: find the shared identifier that exists on both the Stripe customer record and the Cometly visitor session, then use it to link the payment event to the original ad click.
The most reliable matching method is email address. When a user signs up for your product, they provide an email. That same email should be stored on the Stripe customer object when the customer record is created. If Cometly has that email attached to the visitor session via your identify call from Step 2, the match can be made automatically.
To make this work cleanly, verify that the email format is consistent across systems. A common issue is trailing whitespace, capitalization differences, or alias variations that cause email matching to fail silently. Normalize email addresses to lowercase before storing them in both systems.
If your product uses separate internal user IDs that are more reliable than email for matching, configure Cometly to accept a custom parameter. Then pass your internal user ID as a metadata field on the Stripe customer object at the time of account creation.
Here is how to add metadata to a Stripe customer object at creation:
When your backend creates the Stripe customer record, include a metadata object that contains your internal user ID and, ideally, the Cometly visitor ID captured from the browser session. This creates a durable link between the payment record and the marketing session that persists across the entire customer lifecycle.
For subscription businesses, also pass this identifier on the subscription object itself. Stripe's subscription object supports metadata fields just like the customer object. Adding your identifier here ensures that recurring invoice.paid events, which reference the subscription rather than the customer directly, can also be attributed back to the original acquisition campaign.
This is where many attribution setups break down over time. Teams correctly set up customer-level metadata at launch but forget to add it to subscription objects. The result is that initial conversions are attributed correctly, but MRR from renewals shows up as unattributed revenue, which distorts your channel LTV calculations.
One pitfall to avoid: do not rely on name matching as a fallback. Names are not unique identifiers. Two customers named "Alex Johnson" will cause attribution conflicts that are difficult to detect and even harder to untangle after the fact. Always use email or a system-generated ID as your primary match key.
Once this mapping is configured, Cometly can join every Stripe payment event to the marketing touchpoints that preceded it, giving you a complete picture from first ad click to paid customer.
Step 5: Configure Revenue Attribution Models and Reporting
With Stripe data flowing in and customer records matched to marketing sessions, you are ready to configure how that revenue gets attributed across your campaigns. This is where the data becomes actionable.
Cometly supports multiple attribution models, and the right choice depends on your sales cycle and what question you are trying to answer:
First touch attribution: Assigns full revenue credit to the first marketing touchpoint in the customer journey. This is valuable for B2B SaaS companies with longer consideration periods because it reveals which channels are generating initial awareness and intent. If you want to know which campaigns are filling the top of your funnel with customers who eventually convert, first touch is the right lens.
Last touch attribution: Assigns full credit to the final touchpoint before conversion. This shows what actually pushed the customer to sign up and pay. Useful for evaluating retargeting campaigns and bottom-of-funnel content.
Linear attribution: Distributes credit equally across all touchpoints in the journey. This gives a more balanced view but can make it harder to identify which specific channels are driving the most impact.
Data-driven attribution: Uses statistical modeling to assign credit based on actual conversion patterns across your data set. This is the most accurate model when you have sufficient conversion volume, as it reflects the real influence of each touchpoint rather than applying a fixed rule.
For most B2B SaaS teams, running first touch and last touch side by side is the practical starting point. It surfaces both channel discovery patterns and conversion-driving channels without requiring the conversion volume that data-driven models need to be reliable.
Set up your revenue attribution dashboard in Cometly to display revenue by campaign, ad set, and individual ad. This lets you calculate true ROAS and cost per acquired customer at every level of your campaign structure, not just at the account level where performance differences get averaged out.
If your Stripe plan supports recurring revenue events, configure MRR and LTV tracking within Cometly. This is where subscription attribution becomes particularly powerful. Instead of measuring which campaigns drive the most signups, you can measure which campaigns drive customers with the highest average contract value and lowest churn rate. Those are often different campaigns, and knowing the difference changes how you allocate budget.
Map your Stripe subscription stages to your funnel in Cometly: trial started, trial converted, subscription active, and subscription churned. This pipeline view lets you see where different acquisition channels drop off, not just which ones convert at the top.
The success indicator here is straightforward: your Cometly dashboard should now show ad spend alongside Stripe revenue for each campaign, giving you a direct cost-to-revenue comparison that replaces the guesswork of optimizing toward proxy metrics.
Step 6: Send Enriched Conversion Data Back to Ad Platforms
Once Stripe revenue is flowing into Cometly and matched to marketing touchpoints, you have something more valuable than just better internal reporting. You have enriched, revenue-verified conversion data that can be sent back to your ad platforms to improve their machine learning and targeting.
This is the step that closes the loop and often has the most direct impact on ad performance.
Configure Cometly to send purchase and subscription events back to Meta via the Conversions API and to Google via Enhanced Conversions. Critically, include the actual revenue value from Stripe in these events. When ad platforms receive revenue-level signals rather than generic lead events, they can optimize for customer value rather than lead volume.
For B2B SaaS, this distinction matters enormously. A lead event tells your ad platform that someone filled out a form. A revenue event with a dollar value tells it that someone became a paying customer worth a specific amount. The targeting and bidding algorithms respond very differently to those two signals.
With Stripe revenue values flowing back to Meta and Google, you can set up value-based bidding in your campaigns. Instead of optimizing for the lowest cost per click or cost per lead, your campaigns can automatically prioritize audiences most likely to become high-value paying customers. This shift in optimization signal often produces meaningful improvements in the quality of new customers acquired over time.
There is one important pitfall to manage carefully here: event deduplication. Because you are likely running both browser-side pixel tracking and server-side Stripe webhooks, the same conversion event could potentially be reported twice to your ad platforms. This inflates conversion counts and distorts campaign optimization in ways that are hard to detect until you compare your ad platform data against Stripe directly.
Configure event deduplication in Cometly using the Stripe charge ID or subscription ID as the deduplication key. This unique identifier ensures that even if the same event arrives via both the browser pixel and the server-side webhook, the ad platform only counts it once.
After sending enriched events for a few days, check your ad platform dashboards for improvements in audience match rates. You should also see more stable cost-per-conversion figures as the ad platforms recalibrate their targeting based on higher-quality revenue signals. This stabilization is a good indicator that the enriched events are being received and processed correctly.
Verifying Your Setup and Keeping Attribution Accurate Over Time
A Stripe revenue attribution setup is not complete until you have verified it end to end. Do not assume the integration is working correctly based on a single test event in the logs.
Run a full end-to-end test using Stripe's test mode. Create a test signup using a known email address, simulate an ad click session in Cometly, complete a Stripe test payment, and then verify that the full journey appears in Cometly: from the ad click through the identify call to the revenue event, with the correct campaign and channel data attached.
After your setup has been running for a few days with real customers, cross-reference Stripe revenue totals in Cometly against your Stripe dashboard for the same time period. A significant discrepancy between the two totals is a signal that some events are not being matched or that your revenue mapping configuration needs adjustment.
Set up a weekly attribution audit as part of your regular reporting workflow. Check that new Stripe customers are appearing in Cometly with marketing source data attached. Flag any customers showing as direct or unknown traffic, as these often indicate an identification timing issue or a gap in your pixel coverage on a specific page or flow.
As your product evolves, update your Stripe metadata fields and Cometly event mappings whenever you add new pricing plans, product lines, or checkout flows. New pricing configurations often introduce new Stripe event types or change the structure of existing ones, and failing to update your mappings means new revenue stops flowing into attribution reports correctly.
Use Cometly's AI recommendations to identify which campaigns are generating the highest-value Stripe customers, not just the most conversions. This is where the investment in a complete attribution setup pays off: you can reallocate budget toward the channels and creatives that drive customers with the highest LTV, and reduce spend on campaigns that generate volume but not value.
Treat attribution as an ongoing process rather than a one-time configuration. Regular audits keep your revenue data clean and ensure that the marketing decisions you make based on that data are grounded in reality.
Putting It All Together
Setting up Stripe revenue attribution transforms how your marketing team operates. Instead of optimizing for proxy metrics like clicks or leads, every budget decision can be grounded in actual revenue data.
Here is a quick checklist to confirm your setup is complete:
Admin access confirmed: Stripe and Cometly access verified with the correct permission levels.
Pixel installed and users identified: Tracking pixel live on your marketing site and signup flow, with identify calls firing at account creation.
Stripe integration connected: Correct event mappings configured for subscription creation, invoice paid, and charge succeeded events.
Customer identifiers matched: Email or internal ID consistently passed across Stripe metadata and Cometly visitor sessions.
Attribution model selected: Revenue dashboard configured with your chosen model and showing spend alongside Stripe revenue by campaign.
Enriched events flowing back to ad platforms: Meta CAPI and Google Enhanced Conversions receiving revenue-level signals with deduplication configured.
End-to-end test completed: Full journey verified from ad click to Stripe revenue event with correct attribution data attached.
Once this foundation is in place, Cometly gives you a real-time view of which ads and campaigns are driving paying customers, along with AI-powered recommendations to scale what is working and cut what is not. You move from spending based on intuition to investing based on verified revenue outcomes.
If you are ready to connect your ad spend directly to Stripe revenue and finally answer which campaigns are driving growth, Get your free demo today and start capturing every touchpoint to maximize your conversions.





