Categories
Web Apps

SamCart and Google Analytics: Three options for better data

This article was originally published in May of 2017–as of October 2018, Google Analytics Enhanced eCommerce tracking is now natively supported by SamCart. I highly recommend checking that out rather than attempting to implement one of the solutions I’ve documented below. You may still find the information on tracking lifetime value in your CRM via SamCart and Zapier useful, so I’ll keep this post up in its original format.

Here’s the original article:

SamCart is a conversion rate optimized eCommerce platform that launched in 2014, and has been growing steadily ever since. Its primary features are a low tech, turnkey style system that allows you to easily plug your products in and start selling. It also offers one click upsells, upsell funnels, and some other goodies along the way–all for $99/month, with no additional processing fees. They’ve got a free 14 day trial available if you’re interested in exploring more in-depth, or following along with the tutorial below.

This isn’t a SamCart review, so I’ll spare you my somewhat mixed feelings on the platform, and get right to it: SamCart and Google Analytics. How do we make them play nicely together?

The reality is: it isn’t easy. Although SamCart announced Google Analytics Enhanced eCommerce functionality was forthcoming in November 2014, it’s not yet arrived as of publication (May 2017, 3 years later). While SamCart has endeavoured to provide in house stats, they don’t really give you much to work with beyond how much money you’ve made in total and on what day. This is especially true if you’re looking to dig deep into where your conversions are coming from, how one audience converts compared to another, and so on.

Basic SamCart and Google Analytics Setup

This is where third party analytics software, such as Google Analytics, typically come into play. Setting up a basic connection is simple: Hover over your username, go to Settings > General, scroll down to Embed HTML/Scripts and paste the standard Google Analytics tracking code. Tracking goals, specific product purchases, and order values are more complex.

For best results, I recommend using all of the options below in tandem:

#1 – Tracking the summary page

The summary page is the standard page all users see after completing a purchase, even if their referral data has been lost in the PayPal redirect cycle. If you simply want to “count” how many sales you’ve made, this is the way to go. The setup is fairly straightforward.

The goal setup in Google Analytics would be as follows:

Start by creating a Custom Goal (Admin > View > Goals from your GA dashboard). Select Destination and name the goal something along the lines of SamCart Purchase. For the Goal details portion, select the Regular expression option from the drop down menu and enter /summary* in the text field. Hit save and you’re all set.

SamCart purchase goal tracking Google Analytics

What’s wrong with this setup?

The main disadvantage is that users can potentially visit their summary page more than once, which will trigger an additional “hit” for the goal, making your total count inaccurate. I would say your accuracy rate with this option is between 80% and 90%.

#2 – Tracking custom thank you pages

Another fairly simple option for tracking involves using custom thank you pages. You can set these up on specific products pages by clicking “Advanced” and entering the URL in question in the Thank You Page URL field.

Here’s a quick timesaving tip: instead of creating 5 different actual pages for your different products thank you pages, use a parameter like in the above example. In this instance, you would create a page on your website’s backend with the URL “http://yourwebsite.com/thanks”. Then, on each different SamCart product, you would give the URL a different parameter: in this case “?apples”. The same would be true for other products, like “?bananas”, “?oranges”, and “?grapes”. These pages don’t have to actually exist, they just tell Google Analytics the information it needs to know to record the conversion.

The goal setup in Google Analytics would be as follows:

Custom > Goal type: Destination > Begins with: thanks?apples

Remember, yourwebsite.com/thanks?apples doesn’t actually exist, only yourwebsite.com/thanks. As you can see here, I’ve also set a “Value” for this goal of $5. This allows me to unlock features in Google Analytics like “Page Value” (the average value of a sales page, for example) and “Session Value” (the average value of any session a user has on my site).

What’s wrong with this setup?

Similar to option #1, the biggest issue for this goal is that a user can visit the page more than once, causing the goal to trigger multiple times. This is especially frustrating when a goal has an assigned value, because it skews all associated data. I would give this method an accuracy rate of 75% to 85% (mostly because of the capacity for “contamination” of your dollar value stats).

#3 – Using HTTP POST

This method is far and away the most accurate, and also has the most difficult setup process. In the same month that SamCart promised a future where Google Analytics eCommerce was supported, they announced that they were now sending data via HTTP POST. Every time a purchase (or refund) takes place, SamCart sends a “hit” to your specified URL (in this case, ours will be a Google Analytics URL).

Let’s build our “hit” first. We’ll be using an “Event” type hit, which has the follow parameters:

v=1 // Version.
&tid=UA-XXXXX-Y // Tracking ID / Property ID.
&cid=555 // Anonymous Client ID.

&t=event // Event hit type
&ec=video // Event Category. Required.
&ea=play // Event Action. Required.
&el=holiday // Event label.
&ev=300 // Event value.

If you’re not very technical, don’t let your eyes cross just yet. We’ll go through this bit by bit, and use Google’s own Hit Builder Tool to create and test ours. I highly recommend making yourself a spreadsheet to keep track of this information, because you’re going to need it all again when we program the goal into Google Analytics (and it has to match perfectly to work). For our hit the parameters are as follows:

Event Category: SamCart

Even Action: Purchase

Event Label: Apples (this is your product name, typically, but it can be whatever you like)

Event Value: 5 (optional)

Here’s how our hit is going to look when we paste it into the SamCart field:

http://www.google-analytics.com/collect?v=1&t=event&tid=UA-XXXXX-Y&cid=555&ec=SamCart&ea=Purchase&el=Apples&ev=5

IMPORTANT: UA-XXXXX-Y needs to be replaced with YOUR Google Analytics Tracking ID or Property code. This can be found in Admin > Property > Property Settings below Basic Settings labeled as “Tracking Id”.

When your hit is ready (you can use the Hit Builder to test and see if it’s valid), paste it into the Notification URL section of your SamCart product, under the Advanced tab:

The goal setup in Google Analytics would be as follows:

Custom > Goal type: Event > Event Category: SamCart / Even Action: Purchase / Event Label: Apples / Event Value: 5

This MUST match the hit parameters you created. Parameters are as follows: Event Category is ec, Event Action is ac, Event Label is el, and Event Value is ev. (ev is the only value that can be different, select “No” under Use the Event value as the Goal Value for the conversion to enable a custom currency integer like 4.99 instead of 5, which would not be an option when creating the hit).

Quick note: even without setting up the goal, this event will begin tracking once it’s properly setup. Setting up the goal is merely to allow you to access features like those mentioned above (Page Value, Session Value, etc) and get a clearer picture of your sales. You can still checkout your events under Behavior > Events > Overview.

What’s wrong with this setup?

This is about as good as it gets (for now). There’s no worries about an action triggering more than once and, for the most part, it allows you to access a lot of Google Analytics’ features for conversion tracking. However, there are still some issues with referral information getting lost, especially if you have PayPal active in addition to standard credit card processing. (Check out the bonuses for more info.)

That’s it for now! I hope this guide helps you get setup to start collecting quality data from your SamCart sales. Remember, your conversion rate optimization related conclusions are only as reliable as the data they are based upon!

Looking for more? Here’s a few bonus SamCart integrations tips:

Bonus #1: Referral Exclusions (the PayPal redirect loop)

If you have PayPal as an active payment option (one of two at SamCart, the other being being the omnipresent Stripe), you may notice it wreaks havoc on your referral paths. What’s that mean? Well, instead of seeing that a user came to your site via organic search and then converted on sales page #2 or even the contents of a UTM tracking URL, you’ll just see “paypal.com” as the referrer. This is obviously not accurate, and it’s best you strip it out of your Analytics account using the Referral Exclusions option.

Simply go to Admin > Property > Tracking Info > Referral Exclusion List to begin the process. While you’re there, I also recommend adding SamCart itself along with any domains associated with your CRM or e-mail processor.

Bonus #2: SamCart and Infusionsoft or other CRMs (via Zapier)

Zapier is a great tool that anyone can use to help integrate their systems. Recently SamCart was added to that list! Awesome.

One of the most valuable pieces of info you can gather about your “list” is “what is a subscriber worth?” It can help you determine how much to spend on leads, how your organic growth relates to your business income and so on. This final tip is a potential solution for folks who use SamCart and Infusionsoft (or similar CRMs that allow you to create a custom fields related to customer entries.)

(One quick caveat: this Zap uses several premium features)

Your first step will be to go into your CRM and create a custom field. If currency is an option, use that, but if not, a standard decimal number is fine. We’ll call ours “Custom AField”.

Once you’ve got your custom field ready, head over to Zapier to construct your Zap.

Zapier and SamCart and Infusionsoft in 4 Steps

In this case our Trigger is a new order in SamCart, our first Action is to Create/Update. I usually set duplicates to be checked by e-mail so you don’t end up with a lot of repeat contacts, but it happens sometimes. Use the e-mail field from SamCart, and you can take this opportunity to update any other fields you’d like as well using the SamCart order details (first name, last name, etc). Next, we want to setup the Numbers action:

Using the Zapier Numbers Spreadhseet Style Formula

In this case, we’re adding together any existing value in Custom AField with the price of the most recent order. So, say your customer spent $50 5 weeks ago, and today they’ve spent $25. That means the SUM function will generate a value of 75.

Caveat: if you have issues with Zapier not always reading the data for an empty field from Infusionsoft or your CRM as an integer, use this variation on the formula above:

IF(ISNUMBER(YourCustomField),YourCustomField+SamCartOrderTotal,SamCartOrderTotal)

This variation will cause the formula to only run as an equation if it renders YourCustomField as an integer. Otherwise, it will just return the SamCart purchase total.

For the final step, we simply plug the new number back into Infusionsoft.

To do this, we’ll use another Create/Update Contact Action and fill the Lifetime Value field with the SUM from step three.

You’re all set! You can create a Custom Statistics Dashboard on your Infusionsoft Dashboard to keep you updated. You can do this by first creating a Custom Saved Search that includes your new custom field (Lifetime Value). Then, go to your dashboard and click Add Dashboard Widgets > Custom Statistics and customize it as follows:

In this case, I decided to include both SUM (the total of all values in the CRM database for Custom_aField AKA Lifetime Value) along with AVG to give me the average value of a contact.

There you have it! That’s all I’ve got for now for Google Analytics and SamCart integrations, and I hope you enjoyed the bonus content.

Let me know if you have any questions about the process and I’ll try to help you out.

Until next time!

By K. M. Christensen

I'm a conversion auditor and optimization specialist on BC's beautiful coast. I founded Kirin3 to help fellow entrepreneurs and freelancers increase their profit margins and improve task automation so you can work smarter, not harder.

5 replies on “SamCart and Google Analytics: Three options for better data”

In your HTTP Post which uses GA’s measurement protocol, you are just sending ‘555’ as the cid. Do you know of a way for Samcart to retain the client ID so we can pass that back via the measurement protocol to be able to attribute the event to the original session and user which the transaction took place?

If you were wanting to assign a unique value to a specific user (in order to track lifetime value and the like), UserID is superior to CID. You’ll need to enable it at the property level (Tracking Info -> User-ID). Unfortunately I don’t know of a way to pull a UserID value from SamCart at this time. I reckon they have a unique identifier for all customers based on e-mail, but in order to access that number in GA, it would need to be “pushed” via a Javascript event or accessible in the data layer in Google Tag Manager. If you’ve learned anything useful in the mean time, feel free to share!

Hey Kelly – Great post, thank you! One question on the http post solution. Since it fires for new orders, cancellations and refunds, won’t all of these be recorded as purchases in Google? If so, any option to limit which actions this is triggered for? Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *