Google analytics 如何为我的交互式谷歌地图的每个pin设置GA

Google analytics 如何为我的交互式谷歌地图的每个pin设置GA,google-analytics,Google Analytics,我要在我的互动谷歌地图的每个pin上设置事件。 我想跟踪我的PIN上的点击次数。我不太懂Java脚本。请帮我解决这个问题。 我搜索了很多资源,但找不到任何好的答案。如何添加ga? 这是我的代码: <script async defer src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=AIzaSyDKq5aHkZewiUHoVElQlyONF_tM6B6swno&callbac

我要在我的互动谷歌地图的每个pin上设置事件。 我想跟踪我的PIN上的点击次数。我不太懂Java脚本。请帮我解决这个问题。 我搜索了很多资源,但找不到任何好的答案。如何添加ga? 这是我的代码:

<script async defer src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=AIzaSyDKq5aHkZewiUHoVElQlyONF_tM6B6swno&callback=initMap" type="text/javascript"></script>
<script type="text/javascript">
    $(window).load(function(){

        var locations = [
            ['ـــــــشـیـراز',  29.76, 52.6,0, ''],
            ['ـــــــکـرمـان', 30.4, 57.1,1, ''],
            ['ـــــــمـشـهـد', 36.3, 59.65,2, ''],
            ['ـــــــاصـفـهـان', 32.55, 51.68,3, ''],
            ['ـــــــتـبـریـز', 38.1, 46.3,4, ''],
            ['ـــــــتـهـران', 35.7, 51.4,5, ''],
            ['ـــــــرشت', 37.3, 49.6,6, ''],
            ['ـــــــآمل', 36.5, 52.35,7, ''],
            ['ـــــــاهواز', 31.4, 48.65,8, ''],
            ['ـــــــزنجان', 36.7, 48.5,9, ''],
            ['ـــــــساری', 36.6, 53.1,10, ''],
            ['ــــــگرگان', 36.9, 54.45,11, ''],
            ['ـــــــسمنان', 35.6, 53.4,12, ''],
            ['ـــــــقزوین', 36.26, 50,13, ''],
            ['ـــــــکرمانشاه', 34.35, 47.1,14, ''],
            ['ـــــــهمدان', 34.8, 48.5,15, ''],
            ['ـــــــکاشان', 34, 51.4,16, ''],
            ['ـــــــ یزد', 31.9, 54.4,17, ''],

        ];





        var map = new google.maps.Map(document.getElementById('map'), {
            zoom: 6,
            scrollwheel: false,
            center: new google.maps.LatLng(33.75821, 53.16127),
            mapTypeId: google.maps.MapTypeId.styled,


        });

        var infowindow = new google.maps.InfoWindow();

        var marker, i;
        marker = new google.maps.Marker({
            map:map,
            icon: '/img/close.png' // null = default icon
        });

        for (i = 0; i < locations.length; i++) {
            marker = new google.maps.Marker({
                position: new google.maps.LatLng(locations[i][1], locations[i][2]),
                map: map,
                url: locations[i][4]
            });

            google.maps.event.addListener(marker, 'mouseover', (function(marker, i) {
                return function() {

                    infowindow.setContent(locations[i][0]);
                    infowindow.open(map, marker);
                }
            })(marker, i));

            google.maps.event.addListener(marker, 'click', (function(marker, i) {
                return function() {
                    infowindow.setContent(locations[i][0]);
                    infowindow.open(map, marker);
                    window.location.href = this.url;
                }
            })(marker, i));

        }
        var directionsDisplay,
            directionsService,
            map;

        function initialize() {
            var directionsService = new google.maps.DirectionsService();
            directionsDisplay = new google.maps.DirectionsRenderer();
            map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
            directionsDisplay.setMap(map);
        }
        $.getScript('',function(){
            $(document).ready(ready); //calls for the function we defined above (first loading)
            $(document).on('page:load',ready); // the same but for the other loadings
        });

    });

</script>

$(窗口)。加载(函数(){
变量位置=[
['ـــــــشـیـراز',  29.76, 52.6,0, ''],
['ـــــــکـرمـان', 30.4, 57.1,1, ''],
['ـــــــمـشـهـد', 36.3, 59.65,2, ''],
['ـــــــاصـفـهـان', 32.55, 51.68,3, ''],
['ـــــــتـبـریـز', 38.1, 46.3,4, ''],
['ـــــــتـهـران', 35.7, 51.4,5, ''],
['ـــــــرشت', 37.3, 49.6,6, ''],
['ـــــــآمل', 36.5, 52.35,7, ''],
['ـــــــاهواز', 31.4, 48.65,8, ''],
['ـــــــزنجان', 36.7, 48.5,9, ''],
['ـــــــساری', 36.6, 53.1,10, ''],
['ــــــگرگان', 36.9, 54.45,11, ''],
['ـــــــسمنان', 35.6, 53.4,12, ''],
['ـــــــقزوین', 36.26, 50,13, ''],
['ـــــــکرمانشاه', 34.35, 47.1,14, ''],
['ـــــــهمدان', 34.8, 48.5,15, ''],
['ـــــــکاشان', 34, 51.4,16, ''],
['ـــــــ یزد', 31.9, 54.4,17, ''],
];
var map=new google.maps.map(document.getElementById('map'){
缩放:6,
滚轮:错误,
中心:新google.maps.LatLng(33.75821,53.16127),
mapTypeId:google.maps.mapTypeId.styled,
});
var infowindow=new google.maps.infowindow();
var标记,i;
marker=新的google.maps.marker({
地图:地图,
图标:'/img/close.png'//null=默认图标
});
对于(i=0;i
我搜索了很多资源,但找不到任何好的答案。如何添加ga