Analyse Stripe Payment Links Revenue by Traffic Source in Google Analytics 4

Stripe Payment Links are probably one of the easiest ways to sell products or services online. You can drop the link on any static landing page to direct customers to simple checkout screen.

It is not so easy to track and analyse the traffic going through such checkout. Obviously, Stripe gives some options, but they are not ideal:

  • tagging Confirmation Page - you can drop static purchase event tracking on confirmation page but it has serious limitations:

    • if you allow quantity adjustments or use pay-what-you-want model, you won't be able to track actual revenue since it will be dynamic

    • you may not be able to ensure that the page is visited only when a successful purchase was made

  • building custom Confirmation Page - you can develop custom page which will call Stripe API in the background to get all the details of payment link transaction, but it undermine the whole easiness of using payment links

What if there is a simpler way that:

  • ensures perfect data quality and no duplicates

  • requires no custom back-end

Let's see how simple it is to send purchase data to GA4 using Stripe Webhooks and Server GTM Container.

What you need?

Stripe Payment Link

Google Analytics 4 Property

Server GTM Container


How to implement it?

  1. Install Stripe Payment Link Tag in Web GTM Container

    Download our Stripe Payment Link preset from GTM Presets library and upload to your Web GTM Container. This tag will decorate all Stripe Payment Links found on a given page with GA4 client_id as pass it as client_reference_id. This parameter will be added by Stripe to the webhook fired after purchase is made.


  2. Import and install Stripe Client in Server GTM Container

    Next install Stripe Client Server preset. This will create a custom server GTM client that can accept incoming webhooks and transform them into GTM event.

    This preset will also create additional Trigger called Server Event - Stripe Purchase that will fire when such event will be captured.


  3. Configure Google Analytics Tag in Server GTM Container

    Once Stripe Client and Server Event - Stripe Purchase are imported you can create or use existing Google Analytics tag to send purchase event to GA4.


  4. Setup Stripe Webhook

    Having all the setup done in both web and server GTM containers we can setup Stripe Webhook to call our Server GTM Container when a purchase is made through Payment Link (checkout.session.completed)

Discussion