Excluding PayPal as a referrer in Google Analytics

For about a month, my analytics for Stitch People weren’t super helpful. PayPal kept showing up as the top referral source for transactions in my Shopify store analytics:

Google Analytics

As you can see, the bulk of my transactions were showing as having come from paypal.com, which I knew wasn’t really the case. But for some reason, the real referral source of these transactions was being blown away by PayPal.

What’s going on?

It turns out that Google starts a new session anytime someone comes to your site from another site. If we think about this flow when you have PayPal enabled as a payment solution in Shopify (or any other ecommerce platform for that matter), it makes sense. A user comes to your store, adds something to the cart, then goes to checkout with PayPal. They’re redirected to PayPal.com to complete their transaction, and then they come back to your site.

Because someone came to your site from another site (paypal.com in this case), Google Analytics counts it as a new session. This means that PayPal gets credit as the referral for the transaction because it was the last site someone visited before coming to your site and completing a transaction.

How to fix it

First, make sure you’re using Universal Analytics. You can follow the steps outlined here to make sure you’re upgraded.

Now, go to the Admin section in Google Analytics:

Screen Shot 2014-10-08 at 5.10.56 PM

Once there, select the Account you want to change on the left:

Screen Shot 2014-10-08 at 5.12.17 PM

Now, head to the middle column (Property) and open up the Referral Exclusion List under Tracking Info:

Screen Shot 2014-10-08 at 5.08.04 PM

Now, make sure you add paypal.com to this list:

Screen Shot 2014-10-08 at 5.14.53 PM

You’ll also want to add the domains of any other payment gateways you’re using. Here’s the official Shopify documentation.

Session Settings

I’ve also heard reports that this doesn’t always work if a user spends a lot of time at PayPal. This could happen if someone clicks the Checkout with PayPal button, gets redirected to PayPal, and then gets distracted and comes back later to complete their checkout. If you’re running into this problem, try extending the session timeout in Session Settings. By default it’s 30 minutes, but can be changed to 4 hours max.

Session Timeout Settings

Why does this work?

When you add a domain to this list, it doesn’t create a new session when someone visits from one of these domains. In the case of users checking out with PayPal, Google Analytics will check the referring site (paypal.com) against this list. If it finds a match, it won’t create a new session like it was doing before. Instead, the user session will continue and the transaction will be credited to the right source.

Once I made this change, paypal.com stopped showing up as the referral for my transactions, giving me clear insight into where the money was really coming from.

Keep in mind:  This won’t retroactively fix all the transactions that came through with PayPal as the referrer in the past. Because analytics are just a snapshot in time, this will only work for transactions going forward.

Optimizing your site for Facebook sharing

You’ve probably shared a link on Facebook and seen the magic of how it grabs the site title, image, and description automatically. Did you know you can control what Facebook decides to use for that information?

Here’s an example from one of my recent blog posts showing the blog post title, the first few lines of text from the post, and an image.

Open Graph Example

Facebook uses what it calls the Open Graph (OG) to help determine what information should be used when sharing a link to Facebook. By using OG tags in your HTML, you can tell Facebook specifically what information you want displayed when someone shares a link to your website.

Here are a few examples of the kind of information you can specify with OG tags, taken from the Open Graph Best Practices page on Facebook:

  • og:title – The title of your article, excluding any branding.
  • og:site_name – The name of your website. Not the URL, but the name. (i.e. “IMDb” not “imdb.com”.)
  • og:url – This URL serves as the unique identifier for your post. It should match your canonical URL used for SEO, and it should not include any session variables, user identifying parameters, or counters. If you use this improperly, likes and shares will not be aggregated for this URL and will be spread across all of the variations of the URL.
  • og:description – A detailed description of the piece of content, usually between 2 and 4 sentences. This tag is technically optional, but can improve the rate at which links are read and shared.
  • og:image – This is an image associated with your media. Facebook suggests that you use an image of at least 1200×630 pixels.

Here’s what these tags look like in practice:

Good Example

<meta property="og:title" content="Workday Sets Price Range for I.P.O."/>

Notice that this doesn’t have any branding and it doesn’t mention the domain at all. It simply contains the title of the page/post.

Bad Example

<meta property="og:title" content="MyFavNews.com – Business Section- Workday Sets Price Range for I.P.O."/>

This is a bad example because it contains branding and the domain information. When optimizing OG tags for a blog post, the og:title tag should only have the title of the page/post and nothing else.

Again, go check out the Best Practices for these and more examples of proper use of OG tags. You can also look at Facebook’s documentation for Using Objects within Open Graph for a few more details on the different types of content you can include.

Debug Tool

Just like Google has the tool to help you debug your microdata, Facebook has a tool to help debug your Open Graph tags. It’ll show you what your shared post will look like:

Facebook Open Graph Debug Tool

For those of you on WordPress, there are several plugins out there that will help you specify things like og:title, og:image, and other tag information for your pages and posts. One of the most popular plugins that helps you manage these tags is one you probably already have installed.

WordPress SEO by Yoast

WordPress SEO by Yoast

This popular plugin is most commonly used for SEO purposes like making sure your title tags are consistent and correct, letting you specify meta descriptions for each post, etc. It also helps you manage Facebook Open Graph tags. On your dashboard, go take a look at the Social settings section under SEO, where you’ll see a checkbox to include Open Graph meta data, an option to link your Facebook account (either personal or business), and options for the OG tags you want included on the front page.

SEO Settings

When you’re working on a post, you’ll notice a few extra fields below the text editor where you can enter a description and the image you’d like used:

Open Graph Post Settings

If you leave the description field empty, as I’ve done in this example, it’ll just pull the default meta description for the post. If you haven’t specified a general meta description, Facebook will use the first few lines of the post itself.

Once you’ve configured everything, you’ll see the results in the source code of the page you’re looking at. These will show up as meta tags in the head tag of your site, so you won’t need to scroll very far in the source to see it:

Open Graph HTML Example

In this example, the SEO plugin is even including things like tags and categories.

If you’re on WordPress and don’t have WordPress SEO by Yoast installed, go get it right now and turn it on. I’ll write a future blog post that goes into more detail on what exactly the plugin does for SEO, but it’ll at least be helpful for using Facebook Open Graph tags.

If you’re not on WordPress, try searching for an extension/plugin/gem for whatever platform/framework you’re using. And if you need to insert all this manually, be sure to check out the Best Practices.

Microdata and Rich Snippets

If you’ve ever wondered how websites get extra data about their products into their search results, this post is for you. For you WordPress users out there, there’s a link to a plugin you can try down below. But I’d recommend reading through the basic explanation first so you know what’s going on.

By using microdata in your site, your search results may start showing rich snippets, or additional information about your site. You can use microdata to tag different types of content for your site. For example, if you’re doing recipes, your results might look like this:


See the rating, number of reviews, preparation time, and even calorie content? That’s the “rich” part of the search result snippet.

If you’re selling (or reviewing) a product, like headphones, your rich snippet might look like this:


This one shows the rating, the number of reviews, and the price range of the product.

What is microdata?

Simply put, microdata is extra HTML markup that tells search engines what kind of content you have on your site (products, recipes, music albums, reviews, etc). There’s a standard way of marking up your content with microdata, and it doesn’t impact the way your site looks. It’s just some extra behind-the-scenes information about your site’s content, which shows up in search results as rich snippets.

Let’s take a look at some examples. Here’s an example pulled from schema.org of a product listing without microdata:


Here’s that same product with microdata:


It may look a little intimidating, but don’t worry. Let’s break it down by digging into the maroon-colored terms in the example above.

  • itemscope is what defines the scope of the item you’re dealing with. In this case, all the information about the Dell monitor for sale is wrapped in a div with the itemscope attribute. It doesn’t need a value, and you’ll almost always use this in conjunction with itemtype.
  • itemtype is the type of item you’re dealing with (product, reviews, recipes, etc). There’s a list of all the possible item types on schema.org.
  • itemprop is where you define a property about the item. This example uses image, name, and ratingValue as item properties (among others). Again, the proper terms to use here can be found on schema.org for the specific itemtype you’re using.

That’s it. Now take a second to go through the example above and see if you can figure out what each instance of itemscope, itemtype, and itemprop does. By using these three attributes in your HTML, you’re telling search engines what kind of content you have, and specifically what information they should care about when surfacing your site in their search results.

How do I know what microdata markup to use on my site?

Google offers a really helpful Structured Data Markup Helper, which will take the URL of your site and the type of item you want to markup, and help walk you through the attributes and values you should be using.


This should be your first stop as you work on figuring out how to properly use microdata on your site.

How can I test to see if my microdata is working?

Once you’ve tagged your content, you can use Google’s Structured Data Testing Tool, which lets you put in the URL you’d like to test. It’ll show you how it’s interpreting your microdata markup and how the rich snippet will look.

NOTE: Keep in mind that it takes time for your microdata to show up as rich snippets in search results. If you’re having issues with the process, check out this Google article on common issues and questions.

Here’s an example of what Google’s testing tool will show you, from some of my own testing for my wife’s product, Stitch People:


You’ll see that it’s showing product rating, number of votes/reviews, and the price range of the product on the site.

Here’s a sample of what some of my microdata markup looks like to generate that information from StitchPeople.com:


Is there a WordPress plugin that’ll handle microdata for me?

Absolutely. There are several plugins available to help you start using microdata on your site. Take a look specifically at All in One Schema.org Rich Snippets to get started. You can also do a search for ‘schema.org’ on wordpress.org to find other plugins that’ll do the same thing.

Where can I find more info on microdata?

If you want to get a little more technical, you can start diving through the documentation on schema.org. If you’re not using a WordPress plugin or other tool to help you, you’ll probably end up going through the documentation to find the values to use for itemtype and itemprop.

Google also has a great page on microdata that you can check out.