2013-07-22 26 views
0

我有一個提取Google Analytics信息(___umtz)的JS代碼。我只想獲取搜索詞 - 但是,在Firefox上,它始終顯示爲「(未提供)」。在Chrome上,我可以獲取使用的關鍵字,但在FF上,該Cookie列出爲'(未提供)'使用Javascript從Google Cookie中提取關鍵字

舉例: utmcsr = google | utmccn =(有機)| utmcmd =有機| utmctr =(不是%20提供)

utmctr是alwayts(未提供),無論我用什麼關鍵詞爲我的網站。

下面是一個例子代碼:

function parseCookie(name) 

{ 如果(!document.cookie.indexOf( 「__ utmz =」)= - 1){ VAR C2 = readCookie(名); //獲取cookie var ca2 = c2.split('|'); //這個分裂的cookie插入部分

temp = ca2[0].split('.');  // This grabs the first variable together with the numerical info 
    temp2 = temp[temp.length - 1]; // This takes only the variable we are interested in 
    ca2[0] = temp2;     // We then replace the item in the array with just the variable data          

    var src = ' ';     // Will contain the source, if there is one 
    var campaign = ' ';    // Will contain the campaign, if there is one 
    var medium = ' ';    // Will contain the medium, if present 
    var term = ' ';     // Will contain keyword info, if present 
    var cancel = false;    // Used to check for AdWords ID 

    for (i = 0; i < ca2.length; i++) 
    { 
     temp3 = ca2[i];    //First, take each variable (ex. utmcsr=sourcename) 
     temp4 = temp3.split('='); //Splits into an array, with temp4[0] = 'utmcsr, and temp4[1] = 'sourcename' using our above example 

     if (temp4[0] == 'utmgclid') //Identifies the varaible and replaces appropriate items for Google Adwords Campaigns 
     { 
      src = 'google'; 
      medium = 'cpc'; 
      campaign = 'google'; 
      cancel = true;   
     } 

     if (temp4[0] == 'utmccn' && !cancel) 
     { 
      campaign = temp4[1]; 
     } 

     if (temp4[0] == 'utmcsr' && !cancel) 
     { 
      src = temp4[1]; 
     } 

     if (temp4[0] == 'utmcmd' && !cancel) 
     { 
      medium = temp4[1]; 
     } 

     if (temp4[0] == 'utmctr') 
     { 
      term = temp4[1]; 
     } 
    } 

    alert(term); 
} 

}

回答

0

我只是四周,發現你的問題。我正在研究同一個主題,在這裏留下一個印記。我認爲自從你問這個問題2個月以來,你可能會找到你的答案,但我爲這裏的未來搜索者留下一個解決方案。

http://www.adviso.ca/blog/2012/03/21/explication-du-notprovided-dans-les-rapports-google-analytics-resultats-naturels/ 解決方案的來源是上述主題。這不是英文,但你可以用Chrome翻譯它,它會preatty可以理解的。

Google開始使用具有活躍的Google個人資料登錄的用戶使用SSL加入。因此,_utmctr將成爲未提供的值。隨着G配置文件的擴展,關鍵字屬性將從越來越多的搜索者操作中移除。

所以最有可能這是不可能的。

相關問題