0

我有一个提取 Google Analytics 信息 (___umtz) 的 JS 代码。我只想获取搜索词 - 但是,在 Firefox 上,它一直显示为“(未提供)”。在 Chrome 上,我可以获得使用的关键字,但在 FF 上,cookie 列为“(未提供)”

例如:utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)

无论我为我的网站使用什么关键字,utmctr 总是(未提供)。

这是一个示例代码:

function parseCookie(name)

{ if (document.cookie.indexOf("__utmz=") != -1) { var c2 = readCookie(name); // 这得到了 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);
}

}

4

1 回答 1

0

我就在附近,发现了你的问题。我在同一个主题上工作,在这里给你留下一个标记。我想自从你问这个问题的 2 个月以来,你可能会找到你的答案,但我在这里为未来的搜索者留下了一个解决方案。

http://www.adviso.ca/blog/2012/03/21/explication-du-notprovided-dans-les-rapports-google-analytics-resultats-naturels/ 解决方案的来源是上述主题。它不是英文的,但你可以用 Chrome 翻译它,它会很容易理解。

Google 开始对拥有有效 Google 个人资料登录的用户使用 SSL 加密。因此,_utmctr 将因此成为未提供的值。随着 G Profile 的传播,关键字属性将从越来越多的搜索者操作中移除。

所以很可能这是不可能的了。

于 2013-10-08T10:56:45.357 回答