使用Google Analytics(分析)跟踪重定向页面 [英] track a redirect page with google analytics

查看:97
本文介绍了使用Google Analytics(分析)跟踪重定向页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用google analytics来跟踪重定向页面:

我有一个名为 redirect.php 的页面;当我访问像 redirect.php?c = 12345678 这样的url时,php函数在sql查询表上执行查询来解码代码 12345678 ,然后做一个 301 重定向。



做一个 301 重定向以避免重复的内容。)

我希望跟踪每一次访问 redirect.php

例如:

redirect.php?c = 87654321 重定向到 story.php



显然,在Google Analytics中,我无法找到 redirect.php 页面。 story.php referer是 organic / google ,所以我不能依赖引用者。



是否有可能在某些方面跟踪每个重定向?

解决方案

浏览器。无论何时用户通过GA脚本访问页面 - 都会发送用户向Google发送的关于访问的通知。
因为你正在做一个301头重定向 - 没有GA脚本加载,因此谷歌不知道用户已经在该页面上。



选项
$ b


  • 将重定向从301标题切换到包含元重定向和GA代码的页面

  • 切换到另一个分析系统,例如Piwik,并在重定向页面上手动添加数据。
  • 在重定向脚本中实现自己的计数器,从GA中分离


当然,您可以合并这些选项,并说明一个包含元重定向和GA代码的页面,该页面会重定向到redirect.php脚本,该脚本又会转向301头,但这不是最好的解决方案。


I am trying to track a redirect page with google analytics:
I have a page called redirect.php; when I visit an url like redirect.php?c=12345678 , a php function does a query on a sql lookup table to decode the code 12345678 with a previously inserted url, then does a 301 redirect.

(I'm doing a 301 redirect to avoid duplicate content.)
I wish to track every single visit to redirect.php with analytics, but I can't.

For example:

redirect.php?c=87654321 redirects to story.php.

Obviously in Analytics I can't find the redirect.php page. the story.php referer is organic/google so I can't rely on the referer.

Is it possible to track every redirect in some ways?

解决方案

GA works in the browser. Whenever the user visits a page with the GA script - a request from the user to google is sent notifying about the visit. Since you are making a 301 header redirect - no GA script is loaded and therefore google doesn't know the user has been on that page.

Options you have

  • Switch the redirect from 301 header to a page with meta redirect and the GA code
  • Switch to another analytics system such as Piwik and add data to it manually on the redirect page
  • Implement your own counter inside the redirect script, separated from GA

Of course you could merge the options and have, say a page with meta redirect and the GA code, which redirects to redirect.php script, which in turn redirects with a 301 header, but this is not the best solution.

这篇关于使用Google Analytics(分析)跟踪重定向页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆