简体   繁体   中英

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?

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

You can check the sourcecode of the redirect page here 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. Redirection is one of the supposed use for this. Analytics developer documentation has some good examples of this, including handling timeouts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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