Using APIs To Add Insight To Google Analytics/
June 5, 2014
How Much Does Scrap Metal Cost?
About a year ago we were working with a client who wanted to bring some very specific data into their Google Analytics account. They wanted to compare their site traffic with the current price of scrap metal, by adding it as a Custom Variable on the visit. While scrap metal prices aren’t exactly something that would help many other clients, we started thinking more about different kinds of ways we could pull other information from APIs around the web, into Google Analytics, in ways that would increase our insight.
Wait Back Up. What’s an API?
For the non-nerds amongst us (Welcome! We won’t hurt you. One of us. One of us.) API stands for Application Programming Interface. It’s basically a set of rules that allows different programs to talk to each other. For instance, we can use them to ask a question, from our website, to another web location, and the API there will give us an answer we can use. Sometimes it’s just basic information like:
My client’s website: “Hey Scrap Metal API! What’s the current price of Scrap Metal?”
Scrap Metal API: “$100 a pound.”
Other times it’s more involved, like embedding maps or videos onto a page.
There are thousands of APIs. Google has a ton. Social Media like Facebook and Twitter have APIs that let you access information on likes, or if the user is logged in, even some of that user’s information (if they’ve given you permission). There’s a ton of information out there.
What’s the conversion rate for people north of the 38th Parallel?
Google has a Geocoding API which lets you convert any address into geographic coordinates. Maybe you are capturing someone’s address in a form; you could translate that to coordinates, and throw that into Custom Dimensions in Google Analytics. It’s no longer personally identifiable information, so you could insert latitude and longitude points into your data, and then later export them and map them using other APIs. Let’s compare people within a certain distance of the demilitarized zone and see what their conversion is like. (Hint, they probably don’t have electricity so you won’t see many conversions…)
Addendum: Jon Meck, here at LunaMetrics is a coward about pushing the PII boundaries and thinks this is a bad idea. I say he’s wrong, I don’t see latitude and longitude as PII. What do you think? Is it PII? Let us know your thoughts in the comments. If it bothers you though and you worry that it’s PII just round it to the nearest degree so it’s less accurate.
What’s my social media engagement like from neighborhoods containing “Makin’ It Singles”?
Zillow has a neat API called the GetDemographics API which lets you send them an address or zip-code and get back a bunch of interesting information about that location. What’s the median home value? What’s the age of the homes? Is it a neighborhood with more than 50% homes built since 2000? Does it contain the “Makin’ It Singles” demographic group?
Rather than adding a person’s address, you could simply immediately import some of this information into Google Analytics. Capture the information from the user on a form, query the API on the results page using JSON, and then insert it into a Custom Dimension for the user.
Zillow Neighborhood Home Value = 220,600
Zillow Average Year Built = 1980
Zillow Demographic Segments = “Makin’ It Singles|Aspiring Urbanites|Bright Lights, Big City”
It’s not necessarily about that user, but it’s certainly more interesting than segmentation based on city or region/state. Why look at metros when I can segment by people who live in the types of neighborhoods with a transportation characteristic of “Commutes By Bicycle”?
How can Weatherlytics optimize my ad spend?
Is someone more likely to order an umbrella online if it’s raining, even if it’s going to take 2 days to be delivered? Why not see what the user’s weather is currently like with a weather API like the one from World Weather Online? This one is a personal favorite of mine, and one of the earlier ones we hooked up. We can capture the weather, temperature, barometric pressure, wind, and more from local conditions of our visitors. Here’s how it shows up in our old classic analytics account (which has data for a longer time span than our newer universal account, but you could obviously put this data into a Custom Dimension just as easy as a Custom Variable). For about a year we’ve been collecting weather data, and finally I wanted to see if there was any statistical significance in any of it.
Top: Data with temperature(F), humidity, barometric pressure, and wind speed. Bottom: The weather code passed into Google Analytics
I pulled out some data and crunched temperatures and general descriptions. Mostly weather didn’t seem to have a statistically significant effect on registrations for our Google Analytics, Adwords and Tag Manager trainings, except in one area. Temperature. The hotter it gets, it looks like the less likely people are to sign up for our seminars. Anything over 70 degrees seems to affect conversions for the worse.
Of course we had less traffic because there were fewer days of those temperatures, but it remained statistically significant. Why? I dunno. Maybe people are more likely to be indoors and looking for training when it’s colder, and more likely to be outside enjoying the day when it’s warmer.
So what can we do because of this? Maybe we could lower our ad spend when we know it’s over 90 degrees somewhere because people are just not interested in registering for training at those times. If it’s 50 degrees? Up that ad spend my friend. People will be primed to buy the colder it is.
What’s the big takeaway?
Don’t be limited to the information Google Analytics provides, because you don’t have to be. Is there something you’d like to know about a user, or their neighborhood, or their current local weather conditions, or the price of gold, or something else? Maybe there is an API out there that can provide you that information. Get that information from the API, and put it into Google Analytics as a Custom Dimension and start figuring out if those “Makin’ It Singles” neighborhoods with an average home value of over $200,000 are more or less likely to buy an umbrella online if it’s rainy outside, and do it all inside Google Analytics.
What APIs are YOU using to bring additional insights into Google Analytics?
Are there any you’d be interested in us providing some specific code and solutions for?
Comment below and let us know!