Categories: Technology Services

Segmenting Social Media Traffic Using Regular Expressions

I’ve been working on a project for a client and one thing they wanted to know was “what percentage of my overall traffic is from social media?”. This lead into a deep discussion of Reach on the channels they were engaging, and got me looking at creating some Advanced Segments to isolate traffic down to only refers from particular social media sites.

Depending on which type of analytics tool you use, your regular expression might differ, but because I spend 95% of my time in Google Analytics, I’m dedicated this post to it.

Like many things in life, there is more than one option for creating the same segment. John Doherty from Distilled wrote a great port on segmenting social traffic in Google Analytics one way, but I’m here to show you another way using regular expressions (also referred to as REGEX). I would recommend reading a beginner’s guide on regular expressions. Or, you may wish to download and print off a copy of the REGEX cheat sheet for your reference in case you plan to write your own advanced segment later on.

To include .com, or not to include .com? That is the question!

Without .com = facebook|twitter
With .com = facebook.com|twitter.com

Difference = 276

Do you see why? Ahh, people are using it in their URL!

Although the above value is not large in this sample, the number can slowly creep up to you if you are segmenting more channels that others have used in their URL, whether it be a sub-domain or within the domain itself.

**TIP: If you’re working on with a huge chunk of data and you run this Advanced Segment, you most likely will run it via “fast access mode”. To avoid this, you can go into your Traffic Sources report, paste your REGEX into your inline filter at the bottom (top for V5), and voila! You’ve escaped the fast access creeper (note: the inline filter for V5 is not set to REGEX initially and you would need to click on the Advanced link next to the text box to select it).

I hope this helps clean the data up a bit! Let me know if you would write the regular expressions differently, I’d be curious to know.

Jackson Lo

Jackson Lo is an SEO & Social Media Consultant at Cardinal Path. His specialty lies in SEO, Local Search, and Social Media. Over the course of the past year, his involvement in the analytics space has made him more proficient in identifying actionable insights to help clients understand how their efforts in SEO are contributing to their overall online success. Jackson enjoys competitive volleyball, photography, arts and food.

Share
Published by
Jackson Lo

Recent Posts

Google Delays Third-Party Cookie Deprecation to 2025

Google announced on April 23 that it will again delay third-party cookie deprecation (3PCD) in…

2 days ago

Understanding Funnel Reports in GA4

Funnel reports have long been one of the most actionable reports in a marketing analyst’s…

4 days ago

GA4 Monetization Reports: An Overview

GA4’s Monetization reports provide organizations with simple but actionable views into the revenue-generating aspects of…

1 week ago

This website uses cookies.