服务器端Google Analytics - utm变量

时间:2011-10-05 16:27:55

标签: coldfusion google-analytics server-side utm

所以我在我的服务器上设置了一个将根据特定条件调用的页面。此脚本为Google Analytics创建.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" />

1 个答案:

答案 0 :(得分:1)

首先,我会以不同的方式编写变量:

<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