使用 Google Analytics 跟踪文件下载

发布于 2024-11-29 02:44:03 字数 248 浏览 1 评论 0 原文

我有一个 html 文件,当用户将闪存驱动器连接到他们的电脑时,该文件就会被加载。该 HTML 包含指向我们服务器上的 PDF 的直接链接。 (出于某种原因,他们不想将 PDF 放在驱动器上)无论如何,我试图弄清楚如何跟踪从这些驱动器之一访问此 PDF 的次数。

由于用户被直接带到文件而不是登陆页面,有没有办法将分析附加到将用户引导到文件的链接?我认为虚拟页面视图会起作用,但我不明白 GA 将如何获取该数据。

任何人都可以帮助揭开这个神秘面纱吗?

I have an html file that gets loaded when a user connects a flash drive to their PC. That HTML contains a direct link to a PDF on our server. (They don't want to put the PDF on the drive for some reason) Anyway, I'm trying to figure out how to track how many times this PDF is accessed from one of these drives.

Since the user is being taken directly to the file and not a landing page, is there a way I can attach analytics to the link that directs the user to the file? I was thinking a Virtual Page View would work but I don't understand exactly how GA would be getting that data.

Can anyone help demystify this?

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

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

发布评论

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

评论(3

好听的两个字的网名 2024-12-06 02:44:03

GA需要运行javascript。当直接从搜索结果、电子邮件或闪存驱动器点击时,PDF 不会调用 GA。

您也许可以通过在服务器上为运行 GA 代码的页面创建重写规则来跟踪它,然后在该页面上加载 PDF。

我的网站上有一个类似的功能,它运行良好,只是在跟踪 PDF 时,加载 PDF 的页面会夸大我的综合浏览量。我不希望 PDF 与综合浏览量混合在一起,因为这会让习惯于将两者分开的客户感到困惑。我为 PDF“调用”页面创建了一个过滤器,页面浏览量又稳定了下来。

我最终删除了这个方法,并回到服务器日志中进行 PDF 下载,并使用 GA 进行其他操作。

GA 是一个 JavaScript 跟踪器。简单明了。

GA needs to run javascript. PDFs will not invoke a call to GA when hit directly from search results, emails, or flash drives.

You might be able to track it by creating a rewrite rule on your server to a page that runs the GA code then loads the PDF on that page.

I had a similar feature on my site and it worked well except that while tracking the PDFs, the page that loaded the PDF was inflating my pageviews numbers. I didn't want PDF's to be mixed in with pageviews because it confused the client who had been used to separating the two. I created a filter for the PDF 'calling' page and the pageview number settled back down.

I ended up removing this method and falling back to the server logs for PDF downloads and GA for everything else.

GA is a javascript tracker. Plain and simple.

强辩 2024-12-06 02:44:03

问题不在于 JavaScript,因为您可以在本地包含它,而在于 GA 无法处理从文件系统加载的 HTML。

可以构建登陆页面,以便在下载和 GA 发生时自动触发。综合浏览量不会成为问题,因为下载应作为事件进行跟踪

The issue is not the JavaScript, since you can include that locally, but the fact that GA won't work on HTML loaded from a filesystem.

The landing page can be built so that it automatically triggers the download and GA while that happens. Pageviews won't be an issue, since downloads should be tracked as events anyway.

醉生梦死 2024-12-06 02:44:03

您可以将 JavaScript 函数附加到链接,并让它使用 Google Analytics Check 跟踪页面视图

这个了解更多信息。

这是跟踪网站上任何文件下载的简单方法。

You can attach a javascript function to the link and have it track the page view with Google Analytics

Check this out for more.

It's an easy way to track any file download on a website.

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