Setting up Google Analytics goals for a DPD shopping cart

I’m in the middle of what I’m calling Marketing Month. (It started as Marketing March and has now bled into April.)

My main goal for the past few weeks–and the coming weeks as well–is to get a better handle on which of my marketing efforts are most effective, and then find ways to do more of those activities.

One of the first items on the agenda is figuring out how to track where my purchases are coming from.

Google Analytics goals are perfect for this. Goals allow you to specify a destination page where you hope your users end up. In the case of my books, that’s a thank you page that displays after a buyer completes the checkout process. Once you have the goal set up, you get a nice report that shows exactly what the traffic source was for that particular purchase:


I’ve already configured goals for my books on Leanpub, but I also have a WordPress site that I use to sell Sublime Productivity through DPD (yep, that’s an affiliate link there).

This is the site where I’m going to be driving most of my traffic, but at the moment I don’t have any idea where my sales on this site come from. Time to set up a goal.

Setting up Google Analytics for cross-domain tracking

The first step in this process is one that I completed earlier in Marketing Month: configuring Google Analytics to allow it to track visitors to your DPD shopping cart.

The process is more involved than I want to go into here, but DPD has a tutorial that explains it here. If the sight of code makes you hyperventilate, you’ll probably need some help with this. It’s not hard, but it’s not particularly easy, either.

At a high level, you need to tweak the Google Analytics script on your site, then install that customized version of the script in your DPD store. Finally, you need to modify your add to cart button to make use of the tweaks. (Like I said, “At a high level…”)

Figuring out the goal page

I didn’t know offhand what page buyers land on after completing the checkout process, so I created a coupon that would let me “buy” my book for free.

The URL looked something like this:

Configuring a goal

To set up the goal, first log into Google Analytics and go to your site’s Home tab:


Click the Admin tab, then click Goals in the View column:


Click the New Goal button:


From the Template list, select the type of goal you’d like to create. I chose Revenue > Place an order:


Click Next step.

Enter a goal description and select a type. Since I want to confirm that buyers reached a thank-you page, I left the default of Destination selected:


Click Next step again to go to the Goal details page.

Because the DPD thank-you page URL includes information specific to each buyer, we can’t just copy and paste it into the Destination field. Instead, we’ll need to change the dropdown menu from the default Equals to value to Regular expression. This will allow us to find matches based on part of the URL, rather than the entire thing.

Enter the first part of the DPD shopping cart URL, after the site name (the part that ends in .com). In my case, that was /cart/thankyou.

I decided to also enable the Value field and enter a price of $22:


Before you click Create Goal, look for the Verify this Goal link near at the bottom of the screen. If you have had DPD integration set up for a while, this will confirm that your regular expression is configured properly to match your destination page.

Finally, click Create Goal.

Your new goal will appear in the Goals section of the Admin tab.


Unfortunately you can’t see traffic sources from past sales–you’ll need to let Google Analytics collect data for a while before you can view the Source/Medium report.