Recently, I needed to dynamically set a Custom Variable in Google Analytics. This isn’t hard if you’re putting in the web tracking code by hand, but it can be a bit tough working with a plugin.

Yoast’s Google Analytics for WordPress plugin (which I highly recommend) can do this, although it’s not entirely intuitive.

First, you need to throw some Javascript into your <head> to set a global variable. You can set whatever you want here, but make sure it’s got a priority of 1 when you add it to wp_head. That’s the only way to set it before the analytics code gets echoed. Add this to your functions.php file or your own plugin:

function set_your_customvar() {
    echo "
            var yourcustomvar = 'whatever';
add_action( 'wp_head', 'set_your_customvar', 1 );

Obviously, you’ll set your variable to whatever dynamic value you need it to be. In my case, I pulled the value from an existing cookie.

Then, you need to set your custom variable in the analytics code. To do this, go to Settings > Google Analytics in the admin area. Make sure ‘Show advanced settings’ is checked:

Screen Shot 2014-02-14 at 3.47.37 PM

Then, scroll down to the ‘Custom Code’ area. Here, set the custom variable and pull in your global variable from before. Make sure you set the parameters properly. Also, make sure you use single quotes and not double, due to the way the plugin will strip some things out. For instance:


Screen Shot 2014-02-14 at 3.47.55 PM

That’s it! Wait an indiscriminate amount of time (something like 2-24 hours), then log into Google Analytics. Look under Audience > Custom > Custom Variables, and set the ‘Primary Dimension’ to whatever slot you put your variable in.

If you just made the change today, make sure you update the date range Google Analytics is showing to include today. 🙂

February 28, 2014 — 2 Comments — In Blog, Development, SEO, Tutorial, WordPress

We had a good time, didn’t we, WordCamp Miami? There was plenty of information to fit into a small bit of time. With the video and the slides, you go back and take those notes that I told you not to take. 🙂

My slides have links to the sources, so you can find plenty of research and further reading there. (One of the studies’ links is acting up, so you can view Google’s cached version).

Here’re some of my favorite tweets:

Thanks for the warm welcome, WordCamp Phoenix! Apparently, this part of the country has absolutely no trouble showing up at 8am—the room was packed.

Since I had to shorten things up from when I last presented this, we had to skip the ever-enjoyable “Whose Line Is It, Anyway?” video I usually show first.

The slides themselves have links to my sources and are helpful in getting the gist of what we talked about. Here are some of my favorite tweets that took place during the session:

I loved giving this presentation. In lieu of a more traditional, linear this-is-how-you-do-something-better presentation, we stepped back and discussed reframing the place where all of our content actually comes from. We confronted our assumptions about our own users (current and potential clients/volunteers) and applied the way we converse in-person to the way we create and present our content. Simply being more self-aware allows you to be more conscious of the ‘conversation’ you’re having on the web!

It would be too difficult to summarize everything we discussed in 90 minutes (of which we used every second), so here’s just a few of the interesting pieces of content tweeted or Instagram’d during the presentation, along with a few items to help. For the most part, these tweets cover ideas that weren’t on the slides, so I hope they’ll assist with context.

First off, the video from the 5th slide:

As I noted on Twitter, if you enjoyed my presentation, I’d love for you to request me at your local conferences or suggest places for me to apply to speak. It was my first time giving that talk, and, based on feedback, it seemed to really help some folks. I love that! I’m passionate about seeing people get connected to what they’re looking for more quickly.

If you have a speaking suggestion, reply to me on Twitter (that link will tie it to my originally-tweeted request) or send me an email.

Feel free to contact me, as well, if I can help answer any questions! While we can always discuss any potential projects, I’m also open to helping you in any way I can to make a better web.

October 11, 2012 — Leave a comment — In Blog, Digital Atlanta, Presentations, SEO

With nearly every prospective or current client, SEO is an inevitable topic of discussion:

“Will we be able to be a top Google result for our keywords?”
“Do you do SEO?”
“Should we hire an SEO company?”
“Will our ranking go up with a new website?”

…and so on. These are great questions to ask, because your search engine results matter! You should certainly expect that your rankings for certain words in search engines won’t go down with a new site, so long as your content is similar (and similarly structured). However, it’s been increasingly important and difficult to explain that the SEO tactics of 5-10 years ago will not only not work well anymore, many such tactics (called Black Hat SEO) can actually get you penalized. Aside from just keeping up with what’s “bad” today, your site also needs to be built with the future of search algorithms in mind by predicting future changes.

Google is Serious

And now, we’re seeing Google promising to penalize what it considers to be “over-optimized” sites. While it seems he’s stepping into semantics quicksand, Matt Cutts from Google’s Spam Team explained the upcoming change as follows:

So all those people who have sort have been doing, for lack of a better word, “over optimization,” or overly doing their SEO, compared to the people who are just making great content and trying to make a fantastic site, we want to sort of make that playing field a little more level.

And so that’s the sort of thing where we try make the GoogleBot smarter, we try to make our relevance more adaptive, so if people don’t do SEO, we handle that. And we also start to look at the people who sort of abuse it, whether they throw too many keywords on a page or whether they exchange way too many links, or whatever they’re doing to sort of go beyond what a normal person would expect in a particular area.

While there’s really no way to know what this all means specifically, what it’s telling us about future-proofing is vital for developers and clients both to understand. Over at, Joe (humorously) nailed it:

It seems a simple solution may be to basically just create good content, make it easy to find on your site, and then try to get people talking about it via social media.
Hey, wait a minute! That’s what Google has been saying all along!


My Usual Spiel

I always answer the SEO questions by making just a couple of points:

  • I can’t promise you specific search rankings, and you should be extremely wary of anyone who says they can.
  • Your best best is having thoughtful, regularly-updated content that’s relevant to your niche, within semantically-correct, quick-loading code—and that code part is my job. I can help you with initial content, but you future changes and blog posts will affect things going forward.
  • If you’re going to have social media accounts, go for it! But, do it well. Don’t be an ad; create conversation.

 The site that ranks highly—and will in the future—is full of useful, non-spammy content within well-written code. But, that’s not all! The site will also belong to a company or organization that’s being discussed on the web, because blog posts and social media conversations are the backlinks of the future. That’s how it should be, because that parallels the world outside the internet, where word-of-mouth is king. So, let’s get to making great content and building great sites.

April 21, 2012 — 5 Comments — In Blog, Google, SEO