Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6849375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:59:01+00:00 2026-05-27T00:59:01+00:00

According to Google Analytics : The total combined length of any custom variable name

  • 0

According to Google Analytics:

The total combined length of any custom variable name and value may
not exceed 64 bytes. Keep in mind that this is not equivalent to 64
characters. Because names and values are URI encoded when stored, some
characters use more than one byte. For example, = is stored as %3D
rather than = and uses 3 bytes rather than 1. To get a list of URI
encoded values, search the web for URL encoding reference.

I have two questions about that:

  1. Should an encoded equal sign (=) be included in those 64 bytes?
  2. I’ve tried to make a function that makes sure the custom name and value is not too long.
    Can it be improved? (Of course it can.)

    function truncateCustomVarAndSet(index, name, value, scope) {
        var keyValuePair, 
            encodedPair,
            lengthOK = false;
        while (!lengthOK && value.length > 0) {
            keyValuePair = name + '=' + value;
            encodedPair = encodeURIComponent(keyValuePair);
            lengthOK = encodedPair.length <= 64;
            if (!lengthOK) {
                value = value.substring(0, value.length - 1);
            }
        } 
        _gaq.push(['_setCustomVar', index, name, value, scope]);        
    } 
    

Edit: Now using encodeURIComponent instead of encodeURI.

Edit 2: @yahelc changed gaq to _qac, so I removed gaq from the argument list since it isn’t needed anymore.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:59:01+00:00Added an answer on May 27, 2026 at 12:59 am

    I’ve tested pushing custom variables of exactly 64 characters combined, and it looks like 64 is ONLY the encoded bytes of the key and the value, not of any connecting characters.

    You should use encodeURIComponent, because than encodeURI does not encode &, +, and =.

    Also, don’t forget the underscore in front of _gaq. _gaq needs to be a global variable, so, no need to pass it through as a parameter.

    It looks like your general approach works, and avoids the issue of mistakenly cropping the string in the middle of an encoded character (as my previous approach mistakenly did.)

    Here’s a slimmed down version of your code (cuts ~220 chars):

    function truncateCustomVarAndSet(index, name, value, scope) {
        while (value.length && encodeURIComponent(name + value).length > 64) {
                value = value.substring(0, value.length-1);
        } 
        _gaq.push(['_setCustomVar', index, name, value, scope]);        
    } 
    

    Tested with this:

    truncateCustomVarAndSet(3,"34567890345678903=1=1=456789034567895678904567890","211222$#!#11221122112122112eeeqeqqeqefo1op2k1po12kop21pok2p1o",1)
    _gaq.push(["_trackPageview"]);
    

    And that records as:

    Custom Var 3

    label: ‘34567890345678903=1=1=456789034567895678904567890’

    value: ‘211222$’

    scope: ‘1’

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to select name from system_privilege_map System has been granted: SELECT ANY TABLE ...and
According to Google search: since MySQL does not support full outer join, it could
I have set up external link tracking as Goals in Google Analytics according to
On my website I have four custom variables. My issue is that Google Analytics
According to google and some other sources (e.g., http://www.enterprisedt.com/publications/oracle/result_set.html ), if I want to
I am working with google map. According to requirements i need to set different
Is Eventbus more a Mediator or an Observer? According to Google, eventbus mediator gets
According to Google Mail guidelines , bulk mail must contain the header Precedence: bulk
According to Google to allow your article/news to appear in Google News: Display a
According to Google , App Engine replenishes its quota at midnight, Pacific time. It's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.