Google Analytics 上的高级过滤可获取推荐并将其转换为外部链接

发布于 2024-09-27 09:58:21 字数 696 浏览 3 评论 0原文

我一直在使用高级过滤器将完整的引荐路径分段为用户定义的值

alt text

我想要该数据,这显然是可点击的 URL 形式。如果它可以在新窗口中打开,那就更好了。

有人知道我应该向用户定义的值提供什么来获得这种行为吗?

我已经放了一张图片来更好地解释我正在尝试做的事情(很抱歉模糊,但这是客户唯一允许的)。我想做的是将黄色部分(完整链接路径)作为外部链接,以便我可以单击它并访问将用户带到此处的网站。

关于如何做到这一点有什么想法吗?

alt text

请注意示例中给出的文本非常短。在 90% 的推荐中,谷歌删除了仅在标题上显示完整路径的链接:

<div class="a" title="http://www.example.com/vb/showthread.php?s=d0189c38">
    <div class="b">http://www.example.com/vb/show</div>
</div>

谢谢!

I've been segmenting my full referral path to the user defined value using advanced filters.

alt text

I would like that data, which obvious is the form of an URL to be clickable. Would even be better if it could open in a new window.

Anyone knows what I should feed the user defined value to get that behavior?

I've put up an image to better explain what I'm trying to do (sorry for the blur but it was the only the client allowed). What I'm trying to do is put the yellow part (the full link path) as an external link so that I can click on it and just visit the site that brought the user here.

Any thoughts on how to do it?

alt text

Please take into account that the text given in the example is extremely short. On 90% of the referrals google cuts down the link showing the full path on the title only:

<div class="a" title="http://www.example.com/vb/showthread.php?s=d0189c38">
    <div class="b">http://www.example.com/vb/show</div>
</div>

Thanks!

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

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

发布评论

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

评论(3

呢古 2024-10-04 09:58:21

因此,您并不是唯一一个表达对此功能的需求的人,事实证明,包括我自己在内的一些人已经开发了 Greasemonkey 脚本来做到这一点。

这些脚本的最新更新名为 Google Analytics 引用源详细链接,编写者为埃里克·沃尔德。源代码可在脚本存储库中找到,UserScripts.org

我上面链接到的页面在上部包含一个“安装”按钮如果从具有 Greasemonkey 插件的 Firefox 浏览器中单击左角,则会将此脚本安装为 Greasemonkey“用户脚本”。

如果您不想这样做(即您想先修改它,或者您使用不同的浏览器,那么您可以从我链接到的同一页面获取源代码。例如,Chrome 允许您安装 Greasemonkey用户脚本作为扩展,尽管我还没有尝试过,类似地,Safari 有一个类似 Greasemokey 的脚本注入器,可以从中启动该脚本。

So you're not alone in expressing a need for this feature, as evidenced by the fact that several people, including myself, have developed Greasemonkey scripts to do exactly this.

The most-recently updated of these scripts is named Google Analytics Referring Source Detail Links, and was written by Erik Vold. The source is available at the script repository, UserScripts.org

The page i linked to above includes an 'install' button in the upper left-hand corner, which if clicked from a Firefox browser that has the Greasemonkey add-on, will install this script as a greasemonkey 'user script'.

If you don't want to do that (i.e., you want to modify it first, or you user a different browser, then you can get the source from the same page i linked to. Chrome, for instance, allows you to install Greasemonkey user scripts as extensions, although i have not tried this. Similarly, Safari has a Greasemokey-like script injector from which to launch this script.

夜清冷一曲。 2024-10-04 09:58:21

您可以创建一个自定义脚本来为您执行此操作,而不是进行油脂猴更改(每次 GA 更改其 DOM 时都会中断,这很常见)。这样做的好处是面向未来(特别是因为 GA API 需要显式声明版本更改才能使用较新的 API 功能或失去对旧功能的访问权限)。此外,您可以避免重载用户定义的变量,并将它们保留为其他用途。

源域 (ga:source) 和引用路径 (ga:referralPath) 均通过 API 公开。

因此,您需要做的就是按照您想要的方式获得上述视图(或类似的内容):

  • Dimensions: ga:source, ga:referralPath
  • Metrics: ga:visits
  • Segment: gaid::-8 (推荐流量)
  • 排序:-ga:visits

在这里尝试一下。

其外观如下:
alt text

您可以使用众多流行的 Google Analytics 库之一(这里是 PHP),就这样吐出来(伪代码)

<tr>
<td> <?php echo $referral['source'];?> </td>
<td> <a href="<?php echo $referral['source'] . $referral['referralPath'] ;?>" target="_blank"><?php echo $referral['source'] . $referral['referralPath'] ;?></a></td>
<td><?php echo $referral['visits'];?></td>
</tr>

Instead of a greasemonkey change (which would break every time GA changes its DOM, which is often), you could just create a custom script that does this for you. This has the benefit of being future-proof (particularly since the GA API requires explicit declared version changes to use newer API features or lose access to old ones). Further, you could avoid overloading the User Defined variables, and leave them open for other uses.

Both the source domain (ga:source) and the referral path (ga:referralPath) are exposed via the API.

So, all you'd need to do to get the above view (or something similar) the way you want it is as such:

  • Dimensions: ga:source, ga:referralPath
  • Metrics: ga:visits
  • Segment: gaid::-8 (referral traffic)
  • Sort: -ga:visits

Try it here.

Here's what it looks like:
alt text

You could, using one of many popular Google Analytics libraries (here's one for PHP), just spit it out as such (pseudo-code)

<tr>
<td> <?php echo $referral['source'];?> </td>
<td> <a href="<?php echo $referral['source'] . $referral['referralPath'] ;?>" target="_blank"><?php echo $referral['source'] . $referral['referralPath'] ;?></a></td>
<td><?php echo $referral['visits'];?></td>
</tr>
岁吢 2024-10-04 09:58:21

确实没有好的答案,所以我编写了一个扩展程序,您可以将其安装在 Google Chrome 上以实现此行为。

它只是将“用户定义值”中的所有静态文本转换为实际的外部链接。

您可以从 Google 扩展程序页面安装它:

https://chrome. google.com/extensions/detail/dbbnhpimjhganelkoickiabfampiiagl

希望这对某人有帮助。

There was really no good answer so I've made up an extension that you can install on Google Chrome to achieve this behavior.

It simply converts all the static text from "User Defined Value" into actual external links.

You can Install it from the Google Extensions page:

https://chrome.google.com/extensions/detail/dbbnhpimjhganelkoickiabfampiiagl

Hope this helps someone.

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