Adding a Time Zone Filter in Google Data Studio

Heatmaps are a great way to visualize the time and day of the week for conversions on your website. It can help you plan out social posts, optimize bids on Google Ads, and schedule your email marketing campaigns.

However, for many companies that serve customers nationwide, the standard heatmap report in Google Data Studio could lead you to draw incorrect conclusions on when those conversions occur. Luckily, by adding a time zone filter to your reports, you can still gain accurate conversion insights to help you better understand your users.

How Time Is Reported in Google Analytics

Time reported in Google Analytics is based on the time zone you select in your property and view settings. That means that if your time zone in Google Analytics is set to Central Standard Time (CST) and a user converts in Seattle at 7:00 p.m. Pacific Time, your Google Analytics account will show a conversion at 9:00 p.m.

This large discrepancy between the time on the East Coast and the time on the West Coast is the reason why aggregating the hour of day metric within your reporting can lead to inaccurate assumptions about your target audience.

How To Set Up A Time Zone Filter in Google Data Studio

In order to set up time zones in Google Data Studio, you’ll need to set up a custom dimension within your Google Analytics data source. Once you’ve added the data source to your report, go to Resource > Manage Added Data Sources

Click “Edit” once your data source appears.

Then click “Add A Field”

Name your Field Name – I chose the name “Time Zone.” Then you’ll use a Case/When formula to categorize each metro in Google Analytics into a specific time zone.

To make it easy, you can copy and paste the code below:

CASE 
 WHEN REGEXP_MATCH(Metro, '.*(Anchorage AK|Fairbanks AK|Juneau AK).*') THEN 'Alaska Standard Time'
 WHEN REGEXP_MATCH(Metro, '.*(Dothan AL|Birmingham (.*) AL|Huntsville-Decatur (.*) AL|Montgomery-Selma, AL|Little Rock-Pine Bluff AR|Monroe LA-El Dorado AR|Ft. Smith-Fayetteville-Springdale-Rogers AR|Jonesboro AR|Panama City FL|Des Moines-Ames IA|Cedar Rapids-Waterloo-Iowa City & Dubuque IA|Sioux City IA|Rochester-Mason City-Austin,IA|Quincy IL-Hannibal MO-Keokuk IA|Chicago IL|Champaign & Springfield-Decatur IL|Peoria-Bloomington IL|Paducah KY-Cape Girardeau MO-Harrisburg-Mount Vernon IL|Davenport IA-Rock Island-Moline IL|Rockford IL|Shreveport LA|New Orleans LA|Lake Charles LA|Baton Rouge LA|Lafayette LA|Alexandria LA|Minneapolis-St. Paul MN|Mankato MN|St. Louis MO|Kansas City MO|Columbia-Jefferson City MO|Springfield MO|Ottumwa IA-Kirksville MO|St. Joseph MO|Jackson MS|Biloxi-Gulfport MS|Hattiesburg-Laurel MS|Columbus-Tupelo-West Point MS|Meridian MS|Greenwood-Greenville MS|Fargo-Valley City ND|Omaha NE|Lincoln & Hastings-Kearney NE|North Platte NE|Oklahoma City OK|Tulsa OK|Sherman-Ada, OK|Wichita Falls TX & Lawton OK|Memphis TN|Nashville TN|Houston TX|Dallas-Ft. Worth TX|Tyler-Longview(.*) TX|Austin TX|San Antonio TX|Harlingen-Weslaco-Brownsville-McAllen TX|Waco-Temple-Bryan TX|Lubbock TX|Corpus Christi TX|Laredo TX|Beaumont-Port Arthur TX|Amarillo TX|Abilene-Sweetwater TX|San Angelo TX|Victoria TX|Odessa-Midland TX|Milwaukee WI|Green Bay-Appleton WI|Madison WI|La Crosse-Eau Claire WI|Wausau-Rhinelander WI|Duluth MN-Superior WI|Joplin MO-Pittsburg KS|Topeka KS|Evansville IN|Wichita-Hutchinson KS|Minot-Bismarck-Dickinson(.*) ND|Jackson TN|Mobile AL-Pensacola (.*) FL|Bowling Green KY|Sioux Falls(.*) SD).*') THEN 'Central Standard Time'
 WHEN REGEXP_MATCH(Metro, '.*(Washington DC (.*)|Hartford & New Haven CT|Miami-Ft. Lauderdale FL|Tampa-St. Petersburg (.*) FL|Orlando-Daytona Beach-Melbourne FL|West Palm Beach-Ft. Pierce FL|Jacksonville FL|Ft. Myers-Naples FL|Gainesville FL|Atlanta GA|Macon GA|Savannah GA|Augusta GA|Columbus GA|Tallahassee FL-Thomasville GA|Albany GA|Indianapolis IN|South Bend-Elkhart IN|Louisville KY|Lexington KY|Providence-New Bedford,MA|Springfield-Holyoke MA|Baltimore MD|Salisbury MD|Portland-Auburn ME|Bangor ME|Presque Isle ME|Detroit MI|Lansing MI|Grand Rapids-Kalamazoo-Battle Creek MI|Charlotte NC|Greenville-New Bern-Washington NC|Raleigh-Durham (.*) NC|Greenville-Spartanburg-Asheville-Anderson|Greensboro-High Point-Winston Salem NC|Wilmington NC|Boston MA-Manchester NH|New York NY|Utica NY|Rochester NY|Albany-Schenectady-Troy NY|Buffalo NY|Syracuse NY|Burlington VT-Plattsburgh NY|Binghamton NY|Elmira (.*) NY|Watertown NY|Cleveland-Akron (.*) OH|Dayton OH|Cincinnati OH|Columbus OH|Toledo OH|Youngstown OH|Zanesville OH|Wheeling WV-Steubenville OH|Lima OH|Philadelphia PA|Harrisburg-Lancaster-Lebanon-York PA|Johnstown-Altoona-State College PA|Wilkes Barre-Scranton PA|Pittsburgh PA|Erie PA|Charleston SC|Florence-Myrtle Beach SC|Columbia SC|Knoxville TN|Richmond-Petersburg VA|Norfolk-Portsmouth-Newport News VA|Roanoke-Lynchburg VA|Charlottesville VA|Tri-Cities TN-VA|Harrisonburg VA|Charleston-Huntington WV|Clarksburg-Weston WV|Bluefield-Beckley-Oak Hill WV|Parkersburg WV|Ft. Wayne IN|Terre Haute IN|Marquette MI|Alpena MI|Chattanooga TN|Lafayette IN|Flint-Saginaw-Bay City MI|Traverse City-Cadillac MI).*') THEN 'Eastern Standard Time'
 WHEN REGEXP_MATCH(Metro, '.*(Honolulu HI).*') THEN 'Hawaii Standard Time'
 WHEN REGEXP_MATCH(Metro, '.*(Phoenix AZ|Denver CO|Grand Junction-Montrose CO|Colorado Springs-Pueblo CO|Boise ID|Missoula MT|Helena MT|Butte-Bozeman MT|Billings, MT|Great Falls MT|Glendive MT|Cheyenne WY-Scottsbluff NE|Albuquerque-Santa Fe NM|Rapid City SD|El Paso TX|Salt Lake City UT|Casper-Riverton WY|Tucson (.*) AZ|Idaho Falls-Pocatello ID|Twin Falls ID).*') THEN 'Mountain Standard Time'
 WHEN REGEXP_MATCH(Metro, '.*(Los Angeles CA|San Francisco-Oakland-San Jose CA|San Diego CA|Monterey-Salinas CA|Santa Barbara-Santa Maria-San Luis Obispo CA|Sacramento-Stockton-Modesto CA|Chico-Redding CA|Palm Springs CA|Fresno-Visalia CA|Yuma AZ-El Centro CA|Bakersfield CA|Eureka CA|Portland OR|Seattle-Tacoma WA|Spokane WA|Yakima-Pasco-Richland-Kennewick WA|Reno NV|Las Vegas NV|Eugene OR|Medford-Klamath Falls OR|Bend OR).*') THEN 'Pacific Standard Time'
 ELSE 'Not Set/Outside of US'
END

Once you’ve set up your calculated field, you’ll need to add a control drop down to your Data Studio Report.

Within the drop down settings, choose the custom dimension you created and then you’re all set!

Summary

Bad data leads to bad decisions. By adding a time zone filter to your Google Data Studio Reports, you can make better decisions by looking at your data with a more accurate lens.

Stay in the know with email updates!

* indicates required

Transforming Google Data Studio Reports: Using Conditional Formatting

One of the most difficult parts of creating digital marketing reports is effectively and efficiently communicating the results of your online efforts. To help you create more intuitive Google Data Studio reports, I have compiled three great suggestions for you to use. Since these posts are written in a longer “how-to” format, I have spliced them up into three different blogs, making them more digestible. This suggestion is all about using conditional formatting to focus your reader’s attention on specific attributes of your report.

When Conditional Formatting Can Provide Extra Value to Your Reports

Traditionally conditional formatting is used to highlight different thresholds in your reporting. For example, you could highlight in green landing pages that received more than 200 sessions in the past month and had a conversion rate greater than 5%. You could also highlight in red landing pages that had received more than 200 sessions in the past month and had a conversion rate of less than .25%.

You can even use conditional formatting in a less orthodox way, such as highlighting:

  1. Pages where you are performing A/B testing
  2. Pages with a certain version of your contact form
  3. Pages with that highlight a certain brand message
  4. Locations with more than four review stars on Google
  5. Blogs written by certain authors

How To Employ Conditional Formatting in Data Studio Reports

To add conditional formatting to your existing charts, mouse over the right hand side of your screen, where you can select the style tab.

Once you select “Add,” a bar will appear at the bottom giving you the option to create a rule. For a simple rule, select your condition and an input value, then click “Save.”

For a more complex rule, you’ll follow the same process, but the condition selected should be REGEX. If you are not familiar with regex, read my regex 101 blog. Although a much more manual process, it will help you highlight data that doesn’t fit within traditional threshold rules.

Summary

The easier you make it for people to read your reports, the quicker and more likely they are to understand your key takeaways. Highlighting aspects of your reports with conditional formatting will draw your reader’s attention to key takeaways in a visually stimulating way. For other ways to make your Data Studio reports more intuitive, read my other two blogs about cleaning up your URLs and renaming metrics and dimensions.

Transforming Google Data Studio Reports: Renaming Metrics & Dimensions

One of the most difficult parts of creating digital marketing reports is effectively and efficiently communicating the results of your online efforts. To help you create better Google Data Studio reports, I have compiled three great suggestions for you to use. Since these posts are written in a longer “how-to” format, I have spliced them up into three different blogs, making them more digestible. This suggestion is all about making your metric and dimension names more intuitive.

When Metric & Dimension Names Aren’t Intuitive In Your Reports

As you are building your Data Studio reports, you will notice that the names of your metrics and dimensions import as well (as they should). However, sometimes these names are too long or do not match your data after you have applied filters. As a result, you will want to change the names for your metrics and dimensions.

I first found this tip useful with my goal metrics. By default, Data Studio not only imports the goal name, but it also imports the goal number. As a result, instead of your goal reading simply, “Form Submissions,” you would have “Form Submissions (Goal 3 Completions).” To anyone who does not regularly use Google Analytics, this is not only completely irrelevant information, but it can also be confusing information.

Another time this would be helpful is if you have decided to take your Google Analytics reports to the next level and transform your URLs. One example I gave in my previous blog post is transforming your location URLs to match the standard naming conventions of your differing locations when you feature them in your report. For example, instead of having your location URL read “/locations/dallas-main-street/”, it could read “Store #152”.

If you do that, however, it may also be beneficial to change your metric name to “Locations.” This way it is easier for your team to more quickly understand the main takeaways, such as “Here are the main locations that people visited online” or “Here are the locations where the most amount of people filled out a contact form.”

How To Rename Metrics & Dimensions in Google Data Studio

The process of changing the names of your metrics and dimensions in Google Data Studio is quite simple. After you set up your data visualization in a scorecard, table, chart, or other format, mouse over your metrics and dimensions on the right-hand side. A pencil will appear over the “AUT” portion of your metric and the “ABC” portion of your dimension.

After that, fill in the “name” portion of the metric or dimension with the name of your choosing, and you are done!

Summary

The easier you make it for people to read your reports, the quicker and more likely they are to understand your key takeaways. Update your metric and dimension names so that they are shorter and easier to decipher for those outside of the digital marketing world. For other ways to make your Data Studio reports more intuitive, read my other two blogs about cleaning up your URLs and employing conditional formatting.

Transforming Google Data Studio Reports: Cleaning Up URLs

One of the most difficult parts of creating digital marketing reports is effectively and efficiently communicating the results of your online efforts. To help you create more intuitive Google Data Studio reports, I have compiled three great suggestions for you to use. Since these posts are written in a longer “how-to” format, I have spliced them up into three different blogs, making them more digestible. This suggestion is all about making your URLs easier to read and understand.

When URLs Aren’t Intuitive In Your Reports

In a perfect world, your URLs never change and they match your page title to a tee. Unfortunately, this perfect world is far, far away for many analytics practitioners. Furthermore, even when your URL meets both of these conditions, it can be hard to read for people who are not knee-deep in Google Analytics data every day. Below are common cases when you might need to give your URL a different name to make it easier to comprehend for report recipients:

  1. Your Homepage: Often your homepage URL is a simple forward slash. When not accompanied by the rest of your domain, it is less intuitive that the symbol “/” is the front page of your website. Make it easier for your reader by changing the name in your reports to “Homepage.”
  2. Your Location Pages: For multi-location businesses, interpreting URLs is not always impossible, rather it is just inconvenient. Try changing the page path “/locations/dallas-main-street” to “Dallas – Main Street Location.” Even better, stick to standard naming conventions used throughout the organization. For example, if the Dallas Main Street location is referred to as Store # 152, use that nomenclature in your reporting.
  3. Grouping Pages: Sometimes landing pages are more user-friendly without grouping them under a subfolder. For example, you may want to use the URL “example.com/50-percent-off” on your Google Ads campaigns instead of “example.com/landing-page/50-percent-off” to get a higher click-through rate. While this is a smart move by your PPC team, remembering all your landing page URLs when looking at a report can be a pain. Try adding a prefix in your reporting to add more clarity, such as “PPC Landing Page: 50% Off.”

How To Rename URLs In Data Studio

After you have added your data source (in this case, Google Analytics) into Google Data Studio, go to Resource > Manage Added Data Sources.

Click “Edit” once your data source appears.

Name your Field Name – I chose the name “Modified URL.” Then you will use a Case/When formula to categorize your URLs.

In the screenshot, I have given two types of REGEXP_MATCH formulas to produce our desired end result. The first one is

WHEN REGEXP_MATCH(Landing Page, "^/$") THEN "Homepage"

This formula will change the page path “/” to the word “Homepage.” If you are not familiar with regex and haven’t read my regex 101 post, the formula may seem like a foreign language. Translated, the formula says “Whenever you see a landing page that exactly matches ‘/’, make it say “Homepage” instead.

This formula will only work for those who have not prepended the hostname to the URL in Google Analytics. If you have prepended your hostname, make sure to add it in right after the caret.

The second formula is much more simple:

WHEN REGEXP_MATCH(Landing Page, '.*(/locations/dallas-main-street/).*') THEN "Dallas - Main Street"

Translated, this says “Whenever you see the URL ‘/locations/dallas-main-street/’, use ‘Dallas – Main Street’ instead. When you use this formula on your own data, replace my fake URL with the URL you want to use. Even though this formula uses regular expressions, you will notice there is no need for you to escape characters such as dashes or forward slashes in either one of these examples.

Note: If you have a question mark in your URL, you won’t be able to simply escape the character with a slash (\). To make this work, I’ve found you’ll need to instead put your question mark with brackets around it. For example, if my URL was /locations?dallas-main-street/ I would instead write /locations[?]dallas-main-street/

Lastly, make sure when you are transforming URLs that you end your formula with ELSE Landing Page, otherwise, URLs that do not fit into the specific cases you defined will not show up at all, leading to a lot of missing data.

Once you have finished writing your formulas, click Update and then Done!

Summary

The easier you make it for people to read your reports, the quicker and more likely they are to understand your key takeaways. Transform your URLs so that they can be comprehended quicker by those outside of the digital marketing world. For other ways to make your Data Studio reports more intuitive, read my other two blogs about changing your metric and dimension names and employing conditional formatting.

GTM Preview Pane Not Appearing in HTTPS Version of Website

Recently I tried to QA some tags within Google Tag Manager but had issues with the debugging console actually showing up. What was particularly perplexing about this issue was that the preview pane would show up for the non-secure version of the website, but not the secure version of the website. After doing a quick Google search and running through the 17 possible suggestions to fix the issue provided by Analytics Mania, I was still at a loss.

Luckily I work with some pretty smart developers who were able to determine it was a problem with the way the base tag was working. Once that was fixed, we were able to see the preview pane and debug our tags without a problem

What is a Base Tag?

The base tag, also called the document base URL, is a tag located in the header that “specifies a default URL and a default target for all links on a page” (W3 Schools). So say for example you have a domain called link going to your About Us page and the link is simply /about-us/. Your base URL will determine the domain attached to /about-us/. A base URL isn’t required in development. Depending on how it’s implemented, it can help you or hurt you. In our case, it hurt us.

BaseURLHTML

Relativity and GTM’s Debug URL

Google Tag Manager’s main script is a secure script. The debug script is a relative script. You can tell that because instead of starting with a hostname, it starts with //.

Google Tag Manager Debug URL

Most times the relatively of GTM’s debugging URL isn’t an issue. However if the base URL forces an unsecure URL, the preview mode won’t work. If you see this issue, please contact your developer to update the base tag to reflect a secure URL. Voila! Your preview pane will be working again.

Summary

The list of reasons why Google Tag Manager preview pane won’t show up is seemingly endless. Reviewing your base tag can be one more check on your list to ensure you can properly debug your tags.

Stay in the know with email updates!

* indicates required

Career Corner: How to Be a Better Manager

Learning about website analytics is just one part of what I’ve learned over the years. Another part was learning about the working world. This career corner post is all about how to be a better manager.

Praise in public, correct in private. People may not remember what you do, but they’ll remember how you made them feel. Correcting in private allows your team members to save face, which means they’re less likely to harbor resentment and more likely to stay motivated.

Remember, people pick up your bad habits. Be aware of how you influence your coworkers, both new and old. If you notice a team member picking up one of your bad habits, this may be a great opportunity to break the habit together.

Be approachable. While new, open working spaces may mean you don’t have to worry about having an open door policy, you should still be wary of the ways you can indirectly shut yourself off from your teammates. Constantly having earbuds in or being in a visibly bad mood can discourage people from coming to you.

Clearly set expectations. Saying things like “review the data” or “create a write up” can be very ambiguous to someone who has worked with you for less than a year. Try and provide prior examples of what the output will look like or have a procedure written up.

Looking for more career advice? Check out the other career corner posts, including how to advance your career and how to be a better employee.

Stay in the know with email updates!

* indicates required

Tracking Forms that Use an iFrame 

 

You’re a savvy digital marketer – competent in Google Tag Manager and a whiz in Google Analytics. And yet you find yourself scratching your head because you just can’t get your form submissions to record in either. After further investigation, you hear something about an iFrame, which is why you’re here. So how do you track form submissions in an iFrame? 

What Is an iFrame? 

An iFrame (or Inline Frame) is a method of imbedding HTML into your website. In other words, an iFrame is a place on your website where you receive code inserted and controlled by another source.  

There are a variety of reasons why people use iFrames. Most often iFrames are used because they’re easy – sometimes companies don’t have a developer to build the functionality they need themselves or the developers they do have are focusing their energy on bigger tasks. 

If you read up on iFrames, you’ll notice there’s a lot of bias against them. Some claim they’re bad for SEO, others say they’re less secure, still others say they’ll for sure break the functionality of your website. It’s true – adding in code from a completely different source does add in more complexity to your website, which increases the possibility to break elements. However, it’s important to remember that the code in your iFrame is only as good as the developer himself. A crappy developer can result in a crappy iFrame. A great developer can result in a great iFrame  

How Can You Tell if Your Form Is in an iFrame? 

For those of you who don’t like looking at code, this step may be a little daunting, but don’t worry – I’ll hold your hand the whole way! Start by right clicking on the page and clicking “view source.” Search for the term “iframe” (without quotation marks). The word “iframe” is literally how you mark up an iframe in the code. If you don’t see the word in your code, do a happy dance – you don’t have an iframe. 

How Do You Track iFrame Forms in Google Analytics? 

I never want to say tracking in an iFrame is impossible, but unless you’ve got a great developer for these next couple of steps, you may want to remove the iFrame altogether and start a new form from scratch.  

The best method for tracking forms in an iFrame is to have your developer modify the CORS (Cross-Origin Resource Sharing). To understand CORS, you’ll have to understand the concept of the same origination policy – the idea that your website puppiesarecuddly.com only accepts requests from puppiesarecuddly.com, and not from bigbadwolfhackersite.com. Makes sense, right? You should only allow a website with the same origination to make the request. By modifying the CORS (remember – cross-origin resource sharing), you’re allowing other domains to access your resources. For example, if our iFrame referenced the website kittiesarecutetoo.com, we would modify the CORS to allow kittiesarecutetoo.com to allow resources from puppiesarecuddly.com. 

Another way is to contact the owner of your iFrame code to see if he or she will allow you to put your Google Analytics code in the iFrame. If they agree, make sure you set up your Google Analytics account to allow for cross-domain tracking. Remember, the iFrame is technically from another source so it will most likely have another domain. Additionally, you’ll want to make sure you’re not firing double pageviews by having your Google Analytics code in the iFrame. 

Summary 

iFrames aren’t evil – but they do make tracking much more difficult, especially without a good developer by your side. Be prepared add your Google Analytics code into the iFrame, modify the CORS or get rid of the iFrame altogether for successful tracking your form submissions. 

 

Stay in the know with email updates!

* indicates required

Can I Use CIDR Notation in Google Analytics?

 

In your quest for the utmost data integrity, you’ve begun to filter out IP addresses. Filtering our IP addresses is a simple but effective way of making sure that your dataset is as accurate as possible. But what happens when your IT team gives you an IP range you don’t recognize? Read below to see how to handle IP addresses with slashes in them (CIDR notation) in Google Analytics. 

IP Addresses with Slashes: CIDR For Dummies 

The IP range that you’re probably used to seeing is something like XXX.XXX.XXX.XXX, where each XXX is what’s called a “class.” The first XXX is class A, the second class B, the third class C and the fourth class D. Each class contains a number 1-255. 

For those of us at home, we most likely have only one IP address. Your single IP address might look something like this: 10.0.0.0. For larger organizations, it’s likely that you have a range of IP addresses. The range for your organization could look something like this: 10.0.0.0-10.0.0.255. 

As you can guess, this number is a pain to write over and over, so it’s no wonder that developers created a shorthand for ranges like this called CIDR. CIDR (pronounced cider) stands for Classless Inter-Domain Routing. 

Truthfully, CIDR is more complex than I’m making it out to be. More than just a nice shorthand, CIDR was developed as a new way to allow network administrators more flexibility when assigning IP addresses. This flexibility was important in making sure that there weren’t unused IP addresses like there was before. In our example above, the IP range would be abbreviated as 10.0.0/24. 

Does Google Analytics Support CIDR? 

As of right now, no Google does not support CIDR. 

How To Handle CIDR in Google Analytics 

While CIDR notation helps network administrators lighten their workload, it adds a little bit to our workload. First, you’ll need to convert your CIDR notation into a range of IP addresses. 

Your next step is to take your range and convert it to RegEx, which Google does support. I personally like this website because it does both for you in one step: https://d-fault.nl/CIDRtoRegEx. If you’re unfamiliar with RegEx, I’ve got a handy article on regex 101 here. 

Summary 

If your IT team gives you an IP address range that has a slash in it, don’t place it directly into Google Analytics. You’ll want to convert the CIDR notation (IP addresses with slashes) to RegEx so that Google can understand it and you can make sure you’re filtering out the right IP addresses. 

 

Stay in the know with email updates!

* indicates required

What Kind of Regular Expression Engine Does Google Analytics Use and Can I Use Negative Regex in Google Analytics?

 

You’ve started delving into regex. You either (understand it)|(don\’t understand it), but chances are, if you were able to read that joke, you’re in the know. Congrats! Now that you know a little bit about regex and how it works, you’re probably wondering how you can apply it to Google Analytics, Google Tag Manager, Google Data Studio, and any other Google product you can get your hands on. 

While your basic knowledge of regex will no doubt take you far, if you start to get more in depth into regex, you’ll need to know your limitations when it comes to Google products. I’ll start off with a background on regex, so easy a caveman could understand it! Then I’ll go into what kind of regular expression Google uses and whether or not you can use negative regular expressions in Google Analytics goals. 

An Introduction to Regex Commonly Used Terms 

A long, long time ago in a world very far away, I thought there was only one type of regex. Boy was I wrong. As I began reading more and more, I was running into words like regex flavors, regex engines, and regex syntax. After hours and hours of research, I think the best way to explain regex flavors, regex engines, and regex syntax is with pets. 

Disclaimer: With the below metaphor, we’re going to have to assume that there are no outliers among dogs. That’s right, your dog who acts like a cat, your calm Jack Russell terrier, and your golden retriever who absolutely hates people all don’t count here. 

I love dogs. There are many different breeds of dogs. I love regex. There are many different flavors of regex. Each breed of dog has a different look. Some have long hair that you have to groom constantly, others have short oily hair, some coats are all one color, while other coats are different colors.

Overall, dogs have four legs, a tail, paws, and similar body shapes. That’s not to say a Great Dane looks like a Maltese, but from far away you can tell they’re both dogs.  Regular expressions, similarly, have different syntaxes. That is to say, some have long hair that you have to groom constantly…just kidding. In all seriousness though, although the regex can be arranged differently, you still can kind of tell from afar that it’s a regular expression. 

In addition to looking different, different breeds have different characteristics. A Jack Russell Terrier has more energy than a bulldog, golden retrievers are known for being incredibly kid friendly, beagles howl something wonderful/terrible and still other breeds of dogs are known for being a little bit more particular about who they choose to get along with. Often when describing a breed, you’re also describing the way they act and look. When I mention that I have a chocolate lab, you understand that it is brown in color, approximately 60 – 70 lbs., and loves water. In the same way that breeds have characteristics, different regular expression flavors support different behaviors

In the beginning we associated dog breeds with flavors of regex, but we didn’t get into the technical definition. The technical definition of a flavor is the syntax and behavior supported by a particular regex engine, where a regex engine is just the “machine” that processes the regex. Going back to our dog example, each breed is going to look a different way and have different characteristics.

Unfortunately for my extended metaphor, there’s no way to compare a regular expression engine to a dog. A regular expression engine is what actually processes your regular expression.

I’m going to finish my metaphor with a common-sense reminder. Some breeds don’t get along with other breeds. There’s a reason why there’s a big dog section and a small dog section in every dog park. Sure, some can live in harmony with each other (we’ve all seen that one little dog that just loves to play with big dogs), but others can’t. Similarly, different regular expressions are not always compatible with each other. 

What kind of regular expression does Google Analytics use? 

This is the kind of question that you don’t care about until you need to know the answer and can’t find any Google help document to guide you to it. Google’s regular expression engine of choice is RE2, sometimes referred to as ‘golang’ regex. If you’re using very simple regular expressions, this doesn’t matter. Here’s why it became a problem for me though: it doesn’t support negative regular expressions. 

For example, if you’re setting up a destination goal and you want to capture any time someone submits a thank you form, EXCEPT for the help/support thank you form, you are sore out of luck. RE2 does not support negative regular expressions at the time of writing this article. So if you’re looking for the answer for “Can I exclude something with Regex in Google Analytics Goals?” The answer is no. 

Summary 

A regular expression engine is the actual processor of your regular expression. The syntax is how your regular expression looks and the flavor is a combination of the syntax and the different behaviors associated with a regular expression engine. Unfortunately, the flavor used by Google Analytics doesn’t support negative regular expressions, so you can’t use negative regular expressions in your Google Analytics goals. 

 

Stay in the know with email updates!

* indicates required

How Do I Name My Event Tracking?

Now that you know what event tracking is and what you should and shouldn’t be tracking, the next step is to start setting up naming conventions for your event tracking. Each event consists of three to four attributes – a category, an action, a label, and sometimes a value. Selecting the right naming conventions is important for both organization and setting up any event-based goals in Google Analytics, so I’ve outlined pointers for each of the three mandatory attributes and a friendly word of caution. 

Naming Your Event Category 

A category should be a broad attribute, able to cover a number of different interactions. For example, if on your website you’re tracking email clicks, phone calls, and a form submission, a good category might be “Contact.” Another example is if on your website you’re tracking two different sales inquiry forms, a general contact form and a support form, a good category might be “Form.” 

You’ll see that in both of these examples, each of these categories was able to be applied to three or more types of interactions. While there isn’t a hard and fast rule for the number of interactions that need to fit under your category, aim for both scalability and accuracy. For example, If you know you’re going to have a number of people watching a video on your website, the best category may be simply “Video” 

Naming Your Event Action 

The next attribute you’ll need to assign to your event is an action. Many people default to the standard action of “click,” but I want to remind you that there are more actions to complete on your website than just a click. Someone can buy, call, email, download, watch a video, fail to submit a form, succeed in submitting a form, get directions, click a CTA, click an external link, and more! While there’s more wiggle room to be specific here, my main takeaway is to make sure the name you give your action accurately describes the action the user is performing. 

Naming Your Event Label 

Your label is going to be your most specific attribute. You can specify which video someone watched, which CTA they clicked on, who they emailed, which form they submitted and more. It’s important to get very specific here, because without your specificity, your event tracking may be all for naught.

Depending on the skill of the developer implementing your event tracking (or your own skills with Google Tag Manager), your event label can even contain a user’s response within the checkboxes and radio buttons on your website forms. This can serve especially helpful when you’re looking to retarget users who have filled out a form. 

Don’t Collect Personal Identifiable Information (Collecting PII) 

I mentioned this briefly in my post about what not to track with event tracking, but it’s important to reiterate that when creating your event category, action, and label, you should make sure you don’t store information from any form fields that could hold any personally identifiable information (PII).

First and foremost, collecting PII is against Google’s terms of service, and as a result Google could wipe out all the data in your Google Analytics account. Secondly (although much less important), there are so many other databases, such as marketing automation programs and CRMs that can hold this information in a much more useful way. 

Summary 

Naming your event tracking correctly is key to having useful, actionable data. By ensuring you have a broad enough category, an accurate action, and a specific label, all while avoiding PII, you can help set up your business for scalable data collection. 

Stay in the know with email updates!

* indicates required