html - URL string cannot pass to GA Custom Variables via javascript -


i attempting parse url string custom variable in ga using javascript. string want parsed value after parameter etid=

so example using www.site.com/?etid=1234kks0, variable gets returned should 1234kkso.

the code using seems work in browser console when recall variable name, not return in ga,

function getqueryvariable(variable) {        var query = window.location.search.substring(1);        var vars = query.split("&");        (var i=0;i<vars.length;i++) {                var pair = vars[i].split("=");                if(pair[0] == variable){return pair[1];}        }        return(false); }   var etid = getqueryvariable("etid");   _gaq.push(['_setcustomvar',4,'user',etid,1]); 


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -