Google analytics is a great tool for understanding where your website traffic comes from, behavior of your visitors, and ultimately how their visits convert into sales.
DPD offers a Google Analytics integration using Google's Universal Tracking API (analytics.js). In order to ensure accurate reporting in google analytics, its important to start from a clean slate by removing any existing google analytics codes from your site, and in DPD. You can read about how to Remove Unused Analytics Trackers in DPD.
Configure Google Analytics
Follow Google's Guide for steps 1-3. Do not do step 4. This guide will replace the tracking code in step 4 with a cross-domain tracking code that allows you to track sales from your cart.
Configure DPD
Go to Store Setup > Integrations > Google Analytics: Universal Analytics Tracking. Enter your Universal Google Analytics Account ID. It can be found in Analytics under Admin > Property > Property Settings > Tracking ID. It looks like UA-XXXXXX-X. Copy the tracking code from the bottom of this page and click Save.
Integrate your Tracking Code into your Website
DPD automatically inserts the correct tracking code in your shopping cart. All you need to do is paste the tracking code you copied from DPD's integration into your website. For accurate reporting, this needs to be done on every page of your website. If your website solution uses a template, you can normally include it there and it will apply to all of your pages. Make sure you remove any existing google analytics tracking code from your site when you add the new one.
Optional: Configure Referral Exclusions
Google Analytics tracks the Source/Medium of your traffic from the referrer header in your web requests. Because you want to know where the traffic came from initially, google automatically excludes your website's domain from being considered as a referrer. DPD automatically bridges itself into your analytics by configuring analytic's autolinker to to include your cart's traffic.
If you use a payment method that takes redirects your customers away from the cart cart like Paypal Express or Standard, you'll have the unfortunate effect of analytics overwriting your original source/medium with paypal.com. To correct this, go into google analytics for your site, Admin > Property > Tracking Info > Referral Exclusion List > Add Referral Exclusion. Enter "paypal.com" and click Create. You can read more about Referral Exclusions.
Optional: Configure Ecommerce Tracking
DPD's integration automatically sends ecommerce data to Google Analytics when you make a sale, however, Google Analytics does not enable ecommerce tracking by default. You can start collecting this data in Google Analytics by going to Admin > View > Ecommerce Settings > Status > On.
Optional: Configure Goals And Funnels
The most common goal a site may want to track is "make a sale". To track a sale with DPD, you must create a goal that targets your cart's delivery page. In analytics, click Admin > View > Goals > New Goal. Name it "Sale". Set Type: Destination. Click Continue. Select Destination: Begins With. Enter "/cart/deliver" for the destination.
From here you may optionally define a funnel. Funnels are useful for determining where potential customers abandon your site on the way to completing your goal. DPD cannot tell you the best way to configure your funnel, but you generally want to think of the path one would take to your goal: Landing Page > Category Page > Product Page > Product Added to Cart > Sale. The Product Added to Cart step is part of DPD and you should use "/cart/view" for that. See our example below:
Sometimes you may want to track more than one path a customer can take to a sale. You can duplicate this goal and alter your funnel to track multiple paths a customer can take to your goal.
Troubleshoot: Data Not Showing in Analytics
Google Analytics takes between 24 to 48 hours to process data. For high volume websites, they may also limit your processing to a single batch per day, possibly inducing an additional 24 hour delay in some cases. You can read more about Google's Data Limits.
Troubleshoot: Source/Medium Records "Direct/None"
Modern Web browsers work hard to protect the security of a user online. When a user views a website via HTTPS, the entire request is encrypted so that no one else can read their request. When a user views a website using HTTP, the request is not encrypted.
Because HTTP traffic is not encrypted, a clever person on your network could be able to intercept that request and view its content or data submitted. Referrers are problematic in this case because the request referrer header contains the URL of the previously submitted URL, which could have encrypted via HTTPS.
So when a user navigates from an encrypted website (HTTPS) to a non-encrypted website (HTTP), modern browsers will not submit referrer URLs to maintain the secrecy of the previous request. This will show up in Analytics as Direct (as if the user typed in the URL directly) because no referrer data was included in the request.
Depending on your traffic, this may or may not be a problem for your analytics, but we recommend securing your website with an SSL Certificate and serving your web traffic over HTTPS.