如何使用谷歌分析跟踪外部网址

时间:2021-06-16 15:18:02

I have a page who redirect to an external url and I want to track the url.

我有一个页面重定向到外部网址,我想跟踪网址。

sample :

MyPage.aspx (render like)

MyPage.aspx(渲染像)

<a target="_blank" href="Redirect.aspx?id=123456">
<a target="_blank" href="Redirect.aspx?id=abcde">

Redirect.aspx.vb

 url = GetUrlById(id)

Response.Redirect(url)

or     

Response.Clear()
Response.Status = "301 Moved Permanently"
Response.AddHeader("Location", url) //could be google.com or any external link
Response.End()

How to track the url with google analytics?

如何使用谷歌分析跟踪网址?

1 个解决方案

#1


You could use the Measurement Protocol API to POST a Custom Event to Google Analytics.

您可以使用Measurement Protocol API将自定义事件发布到Google Analytics。

In your VB code, before either Response.Redirecting or Response.Ending your redirect, you would have to make an HTTP Post Request to the Analytics Endpoint with the required data in order to log the Custom Event.

在您的VB代码中,在Response.Redirecting或Response.Ending重定向之前,您必须使用所需数据向Analytics Endpoint发出HTTP Post请求以记录自定义事件。

You can check the official documentation here for the list of available and required parameters: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#events

您可以在此处查看官方文档,了解可用和必需参数的列表:https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#events

#1


You could use the Measurement Protocol API to POST a Custom Event to Google Analytics.

您可以使用Measurement Protocol API将自定义事件发布到Google Analytics。

In your VB code, before either Response.Redirecting or Response.Ending your redirect, you would have to make an HTTP Post Request to the Analytics Endpoint with the required data in order to log the Custom Event.

在您的VB代码中,在Response.Redirecting或Response.Ending重定向之前,您必须使用所需数据向Analytics Endpoint发出HTTP Post请求以记录自定义事件。

You can check the official documentation here for the list of available and required parameters: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#events

您可以在此处查看官方文档,了解可用和必需参数的列表:https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#events