Built for startups,
scaled for unicorns
Successfully submitted!
Error! Please try again
Attribution answers the question: which marketing touchpoints actually drove the conversion? When a customer interacts with your referral program and other marketing channels before purchasing, GA4's attribution models determine how much credit the referral gets. Understanding referral attribution helps you invest your marketing budget wisely.
This guide covers configuring GA4's attribution settings for accurate referral tracking, comparing attribution models to see how referral credit changes, and building attribution reports that show the true contribution of your GrowSurf referral program alongside other channels.
Learn how GA4 attributes conversions across multiple touchpoints and what this means for referral tracking.
Adjust GA4's attribution configuration to properly credit referral touchpoints.
Compare how different attribution models credit your referral channel to understand its true impact.
Examine the typical conversion paths that include referral touchpoints.
Track how often referrals assist conversions even when they're not the last touchpoint.
Build clear, executive-friendly reports that show referral program attribution impact.
// GA4 Attribution Analysis via Data API
// Use the Google Analytics Data API to pull attribution data programmatically
const { BetaAnalyticsDataClient } = require('@google-analytics/data');
const analyticsDataClient = new BetaAnalyticsDataClient();
async function getReferralAttribution(propertyId) {
const [response] = await analyticsDataClient.runReport({
property: `properties/${propertyId}`,
dateRanges: [{ startDate: '30daysAgo', endDate: 'today' }],
dimensions: [
{ name: 'sessionSource' },
{ name: 'sessionMedium' }
],
metrics: [
{ name: 'conversions' },
{ name: 'totalRevenue' },
{ name: 'sessions' }
],
dimensionFilter: {
filter: {
fieldName: 'sessionSource',
stringFilter: { value: 'growsurf' }
}
}
});
const referralData = response.rows.map(row => ({
source: row.dimensionValues[0].value,
medium: row.dimensionValues[1].value,
conversions: row.metricValues[0].value,
revenue: row.metricValues[1].value,
sessions: row.metricValues[2].value,
conversionRate: (row.metricValues[0].value / row.metricValues[2].value * 100).toFixed(2)
}));
return referralData;
}
// Example output:
// { source: 'growsurf', medium: 'referral',
// conversions: '145', revenue: '14500',
// sessions: '2300', conversionRate: '6.30' }Last-click attribution systematically undervalues referral programs because referrals often initiate the journey but users return directly or via search to convert. Always use data-driven or position-based attribution to see the full referral contribution.
Report both metrics: direct referral conversions (where referral was the last touch) AND assisted referral conversions (where referral was part of the path). The sum of both represents the true referral program impact. Assisted conversions are often 2-3x the direct conversions for referral programs.
If your product has a 30-day evaluation period, set your attribution lookback to at least 30 days. Too short a window means referral clicks that lead to conversions after the window expires get zero credit, undervaluing your program.
GA4 uses different attribution models in different report sections. The Acquisition reports use last-click by default, while the Advertising section uses data-driven attribution. The same referral channel can show different conversion counts depending on which model is applied. Use the Advertising section for the most accurate multi-touch attribution view.
GA4's User-ID feature helps bridge cookie gaps. When a referred user signs up, set their User-ID so GA4 can track them across sessions even without cookies. Additionally, GA4's consent mode and modeling features estimate conversions from users who decline cookies, helping fill attribution gaps.
GA4 doesn't support fully custom models, but the data-driven model already adapts to your data. If referrals consistently lead to conversions, the data-driven model will naturally give them more credit. For manual analysis with custom weighting, export your attribution data to a spreadsheet or BI tool and apply your own model.
Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies
