Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #329180

    Hi, I need to add an “onclick event” different from each button of my different plans in my web.
    I also need to track the contact form.
    And finally I would like to know if I can add a track event in my anchors
    If you could answer me in Spanish I would appreciate it very much.
    greetings

    • This topic was modified 10 years, 1 month ago by jmguridi.
    #330103

    Hey jmguridi!

    Thank you for using Enfold.

    Please refer to this link: https://kriesi.at/support/topic/how-to-add-google-analytics-event-tracking-code-to-image-links-and-text-links/

    Use different Custom CSS class for different buttons.

    Cheers!
    Ismael

    #331849

    Hi Ismael,
    Sorry, but I try hard and do not achieve that this works.
    I put in functions.php the “ga-track” code exactly in the way you indicate and modified like that:

    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery(“.ga-track a”).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Clics’, ‘BtnPlanBase’, ‘/Consulta_Plan_Base.html’]”);
    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘add_custom_script’);

    I define a custom CSS class on my button with name “BtnPlanBase”
    And last I define the event in google analytics. Try this in a basic html page, without enfold and track very well.

    #332981

    Hey!

    It would appear that you are not using the correct css class in your function.

    .ga-track a is simply guideline of the DOM element receiving the click event. Try replacing it with .BtnPlanBase

    Alternatively, could you please forward us administrative FTP and WordPress credentials to your site for us to have a closer look.

    Please check the “Set as private reply (Only you and moderators will see the content of this post)” option before posting any sensitive information.

    Cheers!
    Arvish

    #333249
    This reply has been marked as private.
    #333680

    Hey!

    Thank you for the login info but I get a Forbidden error when I access the page. Please check.

    Best regards,
    Ismael

    #334032

    just prove those access and work fine.

    #334237

    Hi!

    I get a forbidden error. I’ll ask the rest of the support team to take a look.

    Regards,
    Ismael

    #334393

    Hi!

    Same issue here. 403 forbidden error.

    Could you check and let us know.

    Cheers!
    Arvish

    #335113
    This reply has been marked as private.
    #335355

    Hi!

    I’d suggest using Universal Analytics instead, you can make use of the already defined classes in your different buttons for this, basically you’d just need to include the following custom JS (either via wp_footer insertion or even in the Enfold Google Analytics field):

    <script>
    (function($){
      $(window).load(function() {
        $('.button-1 a').on('click', function() {
             ga('send', 'event', 'button', 'click', 'button-1');
         });
        $('.button-2 a').on('click', function() {
             ga('send', 'event', 'button', 'click', 'button-2');
         });
        $('.button-3 a').on('click', function() {
             ga('send', 'event', 'button', 'click', 'button-3');
         });
      });
    })(jQuery);
    </script>

    Reference:
    https://developers.google.com/analytics/devguides/collection/analyticsjs/events
    Cheers!
    Josue

    #336481

    Thanks a lot Josue! It’s working very well!
    Regards!

    #336487

    You are welcome, glad to help :)

    Regards,
    Josue

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Tracking code on specific button’ is closed to new replies.