Length of Label In Event-Tracking


Please Share

Google Analytics LogoYesterday I posted a question to the Google Analytics community on Google+. I was looking for information as to the max length that could be sent to a label in a Google Analytics Event Tracking. You can follow the question here: Post

As you know the Event Tracking code takes 4 variables (Category,action, Label, value). Now the information on the the site says that Category,action, and Label are strings while value is a number. But there was no information as to the max lengths of these strings. The reason I asked is that an extremely adventurous user on StackOverflow had asked for help with the code for the event tracking. His probably was that he was mixing Classic Analytics and Universal Analytics tracking codes. But I noticed that he was sending document.url to the Label. This idea hadn’t occurred to me before and it made me wonder if it was even possible to send a string that long.    As you probably know the max length of a URL is 2000. I wondered wither or not the Label could store something this big.

I got a lot of activity on my post and it seams that a large number of Google Analytics nerds came out of the wood work.   Julien Coquet was the first to respond with …. I don’t know what to call it but one of the nerdiest spread sheets I have ever seen.    The Google Spreadsheet is public, with inspiration from David Vallejo.    Please go give him a thank you on Google+ if you use this information.

What we have here is a cheat sheet of the Universal Analytics Cookies.  This information in my opinion is priceless for anyone interested in checking to be sure that Google Analytics is getting the correct information, or if you just want to play around a little with what information you are sending.   So I guess we can say the information could be invaluable to all other Google Analytics nerds.   Google Universal Analytics Reference  this spread sheet is set up by Category telling you what the cookie Param name is and gives you a little description to as well.    I also like that has the old Classic Analytics  (ga.js) name as well.    It will make it easier for anyone converting from Classic Analytics to Universal Analytics tracking codes to change anything they may have customized.

The second Google Analtyics nerd to come out of the wood work was  André Mafei.  He took it upon himself to go and test the extremes.   (I thought I was the only one that did stuff like this.)

He even posted us a jsfiddle for his experiments:
I did some experiments here and got:
“Category + Action + Label” max lenght
ga.js = 3862 characters
analytics.js = 7727 characters
This code idea is to try bigger and bigger events and check on Fiddler when it stop being fired, I mean, it stop working.

30 minutes later he responds with:

“In GA interface I was able to see an event label with 1100 characters, and using API I was able to retrieve an event label with 7725 characters. First I thought ga.js limit was inferior to analytics.js limit but in my last experiment I could fire also a ga.js event with 7716 characters.”

Conclusion

The Label Variable in Google Analytics event tracking can defiantly hold a URL,  and there are some real Google Analytics nerds out there.

Please Share


Linda Lawton

About Linda Lawton

My name is Linda Lawton I have more than 20 years experience working as a developer and a database expert. I have been working with several of the Google APIs, since 2012. I helping others in the On-Line community to develop with the Google APIs, by creating my own blog www.daimto.com. This and my presence on a number of On-Line developer forums lead me to be noticed by the Google Analytics API development team. I was nominated for and recently became one of the first Google Developer Experts for Google Analytics.

Leave a comment

Your email address will not be published. Required fields are marked *