使用Google Analytics记录选择变量

时间:2021-11-13 14:47:37

I have a HTML form which involves the user making a selection from a series of images, each image has an onclick function which essentially turns them into checkboxes. The selected image is then passed as a numerical value and matched with an array.

我有一个HTML表单,涉及用户从一系列图像中进行选择,每个图像都有一个onclick函数,基本上将它们变成复选框。然后,所选图像作为数值传递并与数组匹配。

I need to somewhere keep a record of what was selected. The important information is recording how many people chose image 1, how many chose image 2, etc.. Can I pass the selection variable to / and leverage Google Analytics to record that data? I don't have a live Google Analytics account setup so I can't verify for myself at the moment.

我需要在某个地方保留所选内容的记录。重要信息是记录有多少人选择了图像1,有多少人选择了图像2等。我可以将选择变量传递给/并利用Google Analytics记录该数据吗?我没有实时的Google Analytics帐户设置,因此目前无法对自己进行验证。

_gaq.push(['_trackEvent', campId, 'selection', customerId, selectionID]);

Thanks

1 个解决方案

#1


1  

Yes, that'll work. I have Google Analytics set to track all outbound link clicks from my site, e.g.

是的,这会奏效。我将Google Analytics设置为跟踪来自我网站的所有出站链接点击,例如

<a href="http://www.heraldscotland.com/"
  onclick="javascript:_gaq.push(['_trackEvent','outbound-article',
             'http://www.heraldscotland.com']);" 
  target="_blank">HeraldScotland</a>

And that data shows up within Behavior > Events > Top Events > Event Category > Event Action within Analytics looking something like this...

并且该数据显示在行为>事件>热门事件>事件类别>分析中的事件操作中,看起来像这样......

Event Action                Total Events    Unique Events   Event Value     Avg. Value
http://www.b2cqshop.com              30               29             0           0.00
http://*.com              6                5             0           0.00
http://www.ikeahackers.net            3                3             0           0.00
http://www.adafruit.com               2                2             0           0.00

#1


1  

Yes, that'll work. I have Google Analytics set to track all outbound link clicks from my site, e.g.

是的,这会奏效。我将Google Analytics设置为跟踪来自我网站的所有出站链接点击,例如

<a href="http://www.heraldscotland.com/"
  onclick="javascript:_gaq.push(['_trackEvent','outbound-article',
             'http://www.heraldscotland.com']);" 
  target="_blank">HeraldScotland</a>

And that data shows up within Behavior > Events > Top Events > Event Category > Event Action within Analytics looking something like this...

并且该数据显示在行为>事件>热门事件>事件类别>分析中的事件操作中,看起来像这样......

Event Action                Total Events    Unique Events   Event Value     Avg. Value
http://www.b2cqshop.com              30               29             0           0.00
http://*.com              6                5             0           0.00
http://www.ikeahackers.net            3                3             0           0.00
http://www.adafruit.com               2                2             0           0.00