首页 \ 问答 \ Google Analytics(分析) - 跟踪JavaScript重定向出站链接(Google Analytics - tracking an javascript redirect outbound link)

Google Analytics(分析) - 跟踪JavaScript重定向出站链接(Google Analytics - tracking an javascript redirect outbound link)

使用谷歌分析,我希望能够跟踪出站链接,但这些出站链接提供了第三方API,在点击链接时使用JavaScript重定向用户。 链接如下所示:

<a href='#/' onclick="redirect(a00033908, c001406055, b518047627)">anchor text</a>

我不认为eventCategory: 'Outbound Link'的标准GA事件跟踪代码eventCategory: 'Outbound Link'正在发挥作用,因为href ='#/'不会被视为出站链接。

我真的被这个难住并寻找想法。
如果您已设法让GA跟踪JavaScript重定向,请分享一些关于如何使其起作用的信息。

提前致谢。


With Google analytics I'd like to be able to track outbound links, but those outbound links are provided a third party API that uses javascript to redirect the user when the link is clicked. The links look like this:

<a href='#/' onclick="redirect(a00033908, c001406055, b518047627)">anchor text</a>

I don't think the standard GA event tracking code for eventCategory: 'Outbound Link' is going work because the href='#/' will not be considered an outbound link.

I'm really stumped by this and looking for ideas.
If you've managed to get GA to track javascript redirects, please share some info on how you got it to work.

Thanks in advance.


原文:https://stackoverflow.com/questions/43504673
更新时间:2021-12-25 22:12

最满意答案

您可以将这些样式应用于锚点以使其成为块级别,指定宽度,然后调整其边距,如下所示:

a.read{
   display:block;
   width:100px;
   margin:0 auto;
}

或者将其应用于其父元素:

.parent{
   text-align:center;
}

You can apply these styles to the anchor to make it block-level, assign a width, and then adjust its margins like this:

a.read{
   display:block;
   width:100px;
   margin:0 auto;
}

Or apply this to its parent element:

.parent{
   text-align:center;
}

相关问答

更多