服务器端 Google Analytics——utm 变量

发布于 2024-12-08 08:51:09 字数 904 浏览 3 评论 0原文

所以我在我的服务器上设置了一个页面,该页面将根据某些条件被调用。该脚本为谷歌分析创建 .gif 并访问他们的服务器。

我已经与我的客户确认他们看到了页面点击量;然而,有些人希望查看 UTM 变量(utm_campaign、utm_source、utm_term 等)。我似乎无法保留 UTM 变量,我已将它们附加到跟踪字符串,但它们看起来像是被删除了。这需要 UTME 部件吗?

    <cfset TrackingStringFromEDOM = ("http://www.google-analytics.com/__utm.gif?" & 
        "utmwv=4.4sh&" &
        "utmn=#RandRange(0,2000000000)#&" &
        "utmhn=#URLEncodedFormat(urlDomainString)#&" &
        "utmr=%2D&" &
        "utmp=#URLEncodedFormat(utmp)#&" &
        "utmac=#googleID#&" &
        "utmcc=__utma%3D999.999.999.999.999.1%3B&" &
        "utmvid=#id#&" &
        "utmip=127.0.0.0"
    ) />
    <cfoutput>#TrackingStringFromEDOM#</cfoutput><br/><br/>

    <cfhttp method="get" url="#TrackingStringFromEDOM#" timeout="1000" />

So I have set up on my server a page that will be called depending on certain conditions. This script creates the .gif for google analytics and hits their server.

I've confirmed with my clients they're seeing the page hits; however, some want to see UTM variables (utm_campaign, utm_source, utm_term, etc...). I can't seem to get the UTM variables to stay, I've attached them to the tracking string but they look like they're being removed. Will this require the UTME piece?

    <cfset TrackingStringFromEDOM = ("http://www.google-analytics.com/__utm.gif?" & 
        "utmwv=4.4sh&" &
        "utmn=#RandRange(0,2000000000)#&" &
        "utmhn=#URLEncodedFormat(urlDomainString)#&" &
        "utmr=%2D&" &
        "utmp=#URLEncodedFormat(utmp)#&" &
        "utmac=#googleID#&" &
        "utmcc=__utma%3D999.999.999.999.999.1%3B&" &
        "utmvid=#id#&" &
        "utmip=127.0.0.0"
    ) />
    <cfoutput>#TrackingStringFromEDOM#</cfoutput><br/><br/>

    <cfhttp method="get" url="#TrackingStringFromEDOM#" timeout="1000" />

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九歌凝 2024-12-15 08:51:09

首先,我会稍微不同地编写变量:

<cfset TrackingStringFromEDOM = "http://www.google-analytics.com/__utm.gif?" & 
        "utmwv=4.4sh&" &
        "utmn=" & RandRange(0,2000000000) & "&" &
        "utmhn=" & URLEncodedFormat(urlDomainString) & "&" &
        "utmr=%2D&" &
        "utmp=" & URLEncodedFormat(utmp) & "&" &
        "utmac=" & googleID & "&" &
        "utmcc=__utma%3D999.999.999.999.999.1%3B&" &
        "utmvid=" & id & "&" &
        "utmip=127.0.0.0"
     />

另一件事是某些参数似乎不在 gif 参数列表中 - 请检查 http://code.google.com/intl/en/apis/analytics/docs/tracking/gaTrackingTroubleshooting.html#gifParameters

First I would write the variable a bit differently:

<cfset TrackingStringFromEDOM = "http://www.google-analytics.com/__utm.gif?" & 
        "utmwv=4.4sh&" &
        "utmn=" & RandRange(0,2000000000) & "&" &
        "utmhn=" & URLEncodedFormat(urlDomainString) & "&" &
        "utmr=%2D&" &
        "utmp=" & URLEncodedFormat(utmp) & "&" &
        "utmac=" & googleID & "&" &
        "utmcc=__utma%3D999.999.999.999.999.1%3B&" &
        "utmvid=" & id & "&" &
        "utmip=127.0.0.0"
     />

Another thing is some parameters don't seem to be in the list of the gif parameters - please check http://code.google.com/intl/en/apis/analytics/docs/tracking/gaTrackingTroubleshooting.html#gifParameters

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文