Track your sales in Google Analytics 4 (GA4), see which campaigns and pages bring in customers, and follow shoppers from your own website through to checkout.
How it works
Once the integration is on, DPD adds your GA4 tag to every page of your store and reports each completed order to GA4. If your website uses DPD's buttons, widgets or cart components, DPD also connects a shopper's visit on your website to their visit on your store, so GA4 credits the sale to the campaign and traffic source that brought them in.
The integration sends:
- Page views on your store, cart, checkout and thank-you pages.
-
A
purchaseevent for each order, with its revenue, tax, shipping, coupons and products. It's sent once per order. -
Cart events from your website when you use DPD's cart components:
add_to_cart,remove_from_cart,view_cartandbegin_checkout. - The same visitor and campaign from your website to your store, including through DPD's pop-up cart (the lightbox), where browsers often block analytics cookies.
Before you start
- A GA4 property with a web data stream. You'll need its Measurement ID, which looks like
G-ABC1234567. In GA4, go to Admin > Data streams and open your web stream to find it. - Your store's web address, such as
yourstore.dpdcart.com, or your own domain if you've set one up for your store. - To connect visits from your own website: the GA4 tag on your website (added with gtag.js or Google Tag Manager), using the same GA4 property as your store.
Set up the integration in DPD
- In your DPD dashboard, go to Settings > Integrations and choose Google Analytics: gtag.js Tracking (GA4).
- Enter your Measurement ID (
G-...). If you leave off theG-, DPD adds it. - Make sure Enabled is on, then save.
Optional settings
-
Custom code runs on every store page after your GA4 tag is set up. Use it for extra Google tag commands, such as a Google Ads conversion tag (
gtag('config', 'AW-...');). Enter JavaScript only, without<script>tags. - Debug message shows a short notice on your store's pages wherever the tag is added. Turn it on while you test, and off again afterwards.
- More than one GA4 property: add one Google Analytics integration for each property. DPD loads Google's tag once and sends each property its own copy of every purchase.
If your integration still has an old Universal Analytics ID (UA-...), replace it with your GA4 Measurement ID. Google stopped collecting Universal Analytics data in 2023.
Set up in Google Analytics
1. Add your website and store as one site
This lets GA4 treat a shopper who moves from your website to your store as one visit.
- In GA4, go to Admin > Data streams and open your web stream.
- Choose Configure tag settings > Configure your domains.
- Add your website's domain (for example
yourwebsite.com) and your store's domain (for exampleyourstore.dpdcart.com, or your custom store domain). Save.
DPD connects visits from your website even if you skip this step, as long as your website uses DPD's buttons or components and the same GA4 property. We still recommend it: it also covers plain links to your store, and lets GA4 continue the same session, not only the same visitor.
2. Stop payment pages from taking credit for sales
When a customer pays with PayPal, they leave your store and come back. Without this step, GA4 can credit the sale to PayPal instead of the campaign that brought the customer in.
- In the same Configure tag settings screen, open List unwanted referrals. You may need to choose Show more to see it.
- Add
paypal.com, plus the domain of any other payment provider whose page your customers are sent to. Save.
3. Choose your key events
purchase is a key event in GA4 automatically. To also count shoppers who add to cart or start checkout, go to Admin > Events and mark add_to_cart or begin_checkout as key events once they've appeared there.
4. Using Google Ads?
Link your GA4 property to Google Ads, then import the GA4 purchase key event as a conversion. DPD carries Google Ads click IDs (gclid) from your website to your store, so sales can be credited to the ad that brought the customer in.
On your website
DPD's embed codes (buttons, widgets, the pop-up cart and the <dpd-...> cart components) already include DPD's script, which does the rest. Make sure of two things:
- Your GA4 tag is on every page that has a DPD button or component, ideally near the top of the page so it's ready before shoppers click.
- It uses the same GA4 property as your store's integration. If your website sends to a different property, DPD can still connect the visitor, but GA4 will show the store's pages as a separate session.
If your website uses Google Tag Manager
DPD adds its cart events to your data layer in GA4's ecommerce format:
{ ecommerce: null } // clears the previous event's data
{ event: "add_to_cart",
ecommerce: { currency: "USD", value: 19.00,
items: [{ item_id: "EBOOK-1", item_name: "Field Guide eBook",
price: 19.00, quantity: 1 }] } }To send them to GA4, add a GA4 Event tag for each event you want (add_to_cart, remove_from_cart, view_cart, begin_checkout). Fire it on a Custom Event trigger with the same name, and turn on Send Ecommerce data from the data layer. Sites using gtag.js need nothing extra, since DPD sends these events to gtag directly.
Turning it off
To stop DPD's script from adding analytics details to links and sending cart events on your website, add this before DPD's script:
<script>window.__dpd_analytics = false;</script>
Developers who use another analytics tool can also listen for the dpd:analytics browser event, which carries the same details as each cart event.
What you'll see in GA4
| Event | When it's sent | Where |
|---|---|---|
page_view |
Each page of your store, cart, checkout and thank-you page. | Your store |
add_to_cart |
A shopper adds a product, or raises its quantity, with DPD's cart components. | Your website |
remove_from_cart |
A shopper removes a product or lowers its quantity. | Your website |
view_cart |
A shopper opens the cart. | Your website |
begin_checkout |
A shopper chooses Checkout in the cart. | Your website |
purchase |
The first time a completed order's thank-you page is shown. | Your store |
What's in each purchase
| GA4 field | What DPD sends |
|---|---|
transaction_id |
The DPD order number, so you can match GA4 to your DPD orders. |
value |
The order total, including tax and shipping. |
currency |
Your store's currency. |
tax, shipping
|
The order's tax and shipping amounts. |
coupon |
Any coupon codes used, separated by commas. |
affiliation |
Your store's name. |
items |
Each product: its SKU (or DPD product ID if it has no SKU), name, price and quantity. A bundle is listed once, without the products inside it. |
Products use the same ID in cart events and purchases, so GA4's product reports join them up.
Where to find your sales
- Reports > Realtime shows events within seconds, which is handy while testing.
- Reports > Monetization > Ecommerce purchases lists products sold and revenue.
- Reports > Monetization > Checkout journey needs the cart events above, so use DPD's cart components to get it.
- Reports > Acquisition > Traffic acquisition shows which sources and campaigns led to purchases.
Standard reports can take 24 to 48 hours to fill in.
Follow one buyer's visit
Each order in DPD has a Google Analytics panel, under the map on the order page. It shows the buyer's GA4 client ID, their session in each of your GA4 properties, and the campaign they arrived with (source, medium, campaign and ad clicks).
- To see everything that buyer did, from the first page on your website to the purchase, copy the client ID from the order. Then in GA4 go to Explore > User explorer and open that client ID.
- To start from GA4 instead, find the purchase event by its
transaction_id: that's the DPD order number. - If you export GA4 to BigQuery, the client ID is
user_pseudo_idand the session is thega_session_idevent parameter.
When the integration is on but an order has no visitor details, the panel says so and lists the GA4 properties your store sends to. That's normal for orders you enter by hand, orders placed before November 2026, and buyers who block analytics. If your integration still has a UA- ID, the panel warns you to replace it.
Why GA4's numbers won't match DPD exactly
- Ad and tracking blockers stop GA4 for some shoppers, so their orders never reach GA4. DPD's own reports always include every order.
- The purchase is sent from the shopper's browser on the thank-you page. If a shopper never reaches it, GA4 won't count that order. That can happen when they close the window during payment, or when a payment completes later, such as a delayed PayPal payment.
- Subscription renewals and later installment payments aren't sent to GA4. Only the first purchase is.
- Reloading or bookmarking the thank-you page, or opening it from the receipt email, doesn't count the sale again.
- GA4's revenue includes tax and shipping, since DPD sends the order total.
Check your setup
Allow about 15 minutes. You'll need a way to place a test order, such as a payment method in test mode or a 100% off coupon. See How to Test Your Products in DPD.
-
Check the tag is on your store. Open your store, view the page source, and search for your Measurement ID. You should find
googletagmanager.com/gtag/js?id=G-.... Or turn on the integration's Debug message and look for the notice on the page. -
Open Google Tag Assistant. Go to tagassistant.google.com, connect it to your website, and add
?utm_source=dpd-test&utm_campaign=setup-checkto the address so you can spot your visit later. -
Shop like a customer. Click a DPD button or add a product with DPD's cart, then go to checkout. Tag Assistant should follow you onto your store's domain in the same session. If you use DPD's cart components, you'll see
add_to_cart,view_cartandbegin_checkouton your website. -
Look at the address when your store opens. It should include
_gl=and__dpd_ga=, along with yourutm_tags. If your store opens in DPD's pop-up cart, use a link that opens it in a new tab for this check. Seeing__dpd_gabut no_glusually means your website's GA4 tag isn't on that page, or hadn't loaded yet when you clicked. -
Place a test order and stay on the thank-you page. In GA4, go to Admin > DebugView. You should see one
purchaseevent with your test order's number as itstransaction_id, and the right total and products. -
Reload the thank-you page. No second
purchaseshould appear. -
Check the source. In Reports > Realtime, your test visit should show the
dpd-testsource andsetup-checkcampaign. It shouldn't show dpdcart.com, PayPal or "(direct)". - Turn the Debug message off again.
Troubleshooting
No purchases appear in GA4
- Check the integration is Enabled and the Measurement ID starts with
G-. An oldUA-ID no longer collects data. - Test with ad blockers and privacy extensions turned off.
- Make sure the test order completed and you reached the thank-you page. Pending payments aren't sent until they complete, and only if the thank-you page is opened afterwards.
- Standard reports lag by up to 48 hours. Check Realtime or DebugView instead.
Sales show up as "(direct)", as referrals from dpdcart.com, or from PayPal
- Add your website and store domains under Configure your domains, and PayPal under unwanted referrals.
- Check your website and your DPD integration use the same GA4 property.
- Plain links to your store that don't go through DPD's script (for example, typed in by hand, or in an email) can't carry your website's visit, so they start a new one.
Each sale is counted twice
- Look for two Google Analytics integrations sending to the same property, and remove one.
- Check the integration's Custom code, and any conversion tracking integration, for your own
purchaseevent. DPD already sends one.
Cart events don't appear in GA4
- Cart events come from your website, so they need DPD's cart components and your website's GA4 tag.
- On Google Tag Manager sites, set up the GA4 Event tags described under If your website uses Google Tag Manager.
- Check your site doesn't set
window.__dpd_analytics = false.
Questions about your setup? Contact DPD support with your store name and the page you tested.