简体   繁体   English

在重定向到外部网站之前发送GA事件

[英]Send GA Event Before Redirection to external website

How to make sure that Google analytics received the event i sent from my website before redirecting to external website using javascript, and also make sure that the redirection happen if the GA/GTM code was blocked on users's browser? 在使用javascript重定向到外部网站之前,如何确保Google Analytics(分析)收到了我从我的网站发送的事件,并且还确保如果GA / GTM代码在用户的浏览器中被阻止,则重定向会发生?

I know that delaying the redirection or doing the redirection via GTM can solve that issue but delaying approach could be annoying and affect the user experience a bit negatively and doing the redirection through GTM can cause the redirection to fail if the user browser was blocking the GTM/GA tracking 我知道延迟重定向或通过GTM进行重定向可以解决该问题,但是延迟方法可能会令人烦恼,并给用户带来负面影响,并且如果用户浏览器阻止了GTM,则通过GTM进行重定向会导致重定向失败/ GA追踪

You can check the sourcecode of the redirect page here https://bonvivo.de/amazon/ 您可以在此处查看重定向页面的源代码https://bonvivo.de/amazon/

Analytics has a specific hitCallback feature that allows you to run some code right after the data were sent to analytics servers. Analytics(分析)具有特定的hitCallback功能,可让您在将数据发送到Analytics(分析)服务器之后立即运行一些代码。 Redirection is one of the supposed use for this. 重定向是此的预期用途之一。 Analytics developer documentation has some good examples of this, including handling timeouts. Analytics(分析) 开发人员文档提供了一些很好的示例 ,包括处理超时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM