Tagged: google analytics, Tracking
-
AuthorPosts
-
February 13, 2019 at 1:28 pm #1066478
Hi, i follow this topic (https://kriesi.at/support/topic/please-clear-this-up-for-em-ga-tracking-2/#post-348525) to fix my issue but it doesn’t work.
I have an image banner with an external link. I use IMAGE ALB element. This is my code i try to use following the previous topic:
function my_custom_attr(){
?>
<script>
jQuery(window).load(function(){
jQuery(‘.banner-capitalcell a’).attr(‘onClick’,’ga(\’send\’, \’event\’, \’Capitalcell\’, \’Clic\’, \’Home\’)\;’);
});
</script>
<?php
}
add_action(‘wp_footer’, ‘my_custom_attr’);But it doesn’t work. How can i fix it?
February 16, 2019 at 5:39 pm #1067730Hey Marc,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaFebruary 17, 2019 at 9:35 pm #1068031Hi, i give you the link in private content. The first image banner link to an external url. I want to track with GA the clicks of this banner.
Thanks,
February 18, 2019 at 3:17 pm #1068391Hi mllibre,
Best regards,
VictoriaFebruary 18, 2019 at 4:20 pm #1068434Hi Victoria, i define the class in the image element. I attach you a screenshot in private content.
Best regards
February 22, 2019 at 8:31 am #1070256Hi,
Thanks for the update.
Where did you add the image element? I did find the same picture in the home page, but it was added in a slider, not an image element. And I can’t find the custom css class attribute when I check the markup. Please provide a link to the actual page with the image element.
Best regards,
IsmaelFebruary 22, 2019 at 11:32 am #1070282Sorry, you’re right. I have an Easy Slider for screens bigger than 990px, and the image only for screens smaller than 990px. Both elements (easy slider and the image have a class called banner-capitalcell)
I would like to track as an event every link to this url.
In the functions.php i have:function my_custom_attr(){
?>
<script>
jQuery(window).load(function(){
jQuery(‘.banner-capitalcell a’).attr(‘onClick’,’ga(\’send\’, \’event\’, \’Capitalcell\’, \’Clic\’, \’Home\’)\;’);
});
</script>
<?php
}
add_action(‘wp_footer’, ‘my_custom_attr’);Thanks,
February 25, 2019 at 5:00 am #1071128Hi,
The event tracker is working. The following information is transmitted when you click on the image. (see private field)
Did you create a goal in your ga console?
// https://support.google.com/analytics/answer/1032415?hl=en
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.