简体   繁体   English

谷歌地图标记与谷歌分析onclick事件变量

[英]google maps markers with google analytics onclick event in variable

I've set up a site with a google map with markers. 我已经建立了一个带有标记的google map的网站。 All the info (name, address, email, url) is entered by the editors of the website. 所有信息(名称,地址,电子邮件,URL)都由网站的编辑者输入。 http://oktamsterdam.nl/google-map-op-homepage/ http://oktamsterdam.nl/google-map-op-homepage/

To create markers I put all markerinfo in a variable 为了创建标记,我将所有markerinfo放入了一个变量中

locaties = [
['Ouder- en Kindteam Centrum', '52.38022', '4.88348', '<h3>Ouder- en Kindteam Centrum</h3><a href="tel:0205555961"  onclick="ga(\x27send\x27, \x27event\x27, \x27Index\x27, \x27tel\x27, \x270205555961\x27);" >020 555 5961</a><br />Open: ma &#8211; vr van 8.30 – 17.00'],
['Ouder en Kindteam West', '52.37791', '4.84876', '<h3>Ouder en Kindteam West</h3><a href="mailto:bosenlommer@oktamsterdam.nl"  onclick="ga(\x27send\x27, \x27event\x27, \x27Index\x27, \x27mailto\x27, \x27bosenlommer@oktamsterdam.nl\x27);" >bosenlommer@oktamsterdam.nl</a><p>&nbsp;</p><a href="tel:0205555961"  onclick="ga(\x27send\x27, \x27event\x27, \x27Index\x27, \x27tel\x27, \x270205555961\x27);" >020 555 5961</a>']
];  

To make sure quotes and double quotes don't get mixed up I user \\x27, but the company that handles all Google Analytics tell me nothing is coming in (All 'normal' onclick event are, like 为了确保引号和双引号不会混淆,我的用户是\\ x27,但是处理所有Google Analytics(分析)的公司告诉我什么都没进来(所有“正常” onclick事件都是

<a href="mailto:info@oktamsterdam.nl" onclick="ga('send', 'event', 'Index', 'mailto', 'info@oktamsterdam.nl');" >info@oktamsterdam.nl</a>

are) 是)

Does anyone has a solution for this? 有人对此有解决方案吗? Thanks in advance. 提前致谢。

I have used single quote in my case and it works. 我在我的情况下使用了单引号,它可以工作。 You can follow this: 您可以遵循以下步骤:

'<a href="' + url + '" onclick="_ga.push([\'track\', \'Download\', \'' + title + '\', \'format\']);">Download</a>';

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

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