Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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?

    #1067730

    Hey Marc,

    Could you please give us a link to your website, we need more context to be able to help you.

    Best regards,
    Victoria

    #1068031

    Hi, 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,

    #1068391

    Hi mllibre,

    Best regards,
    Victoria

    #1068434

    Hi Victoria, i define the class in the image element. I attach you a screenshot in private content.

    Best regards

    #1070256

    Hi,

    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,
    Ismael

    #1070282

    Sorry, 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,

    #1071128

    Hi,

    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

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.