Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1092920

    Hi,

    I ran a search on the forum and didn’t find recent answer.
    Is it possible to track file download with the enfold integrated google analytics tracking code ?

    Thanks
    Regards
    Erd

    #1092942

    Hey Erdrol,
    Tracking downloads requires changing the code a little, you’ll want to add an “Event” to the code. Here’s the official Google Analytics link to do this, but this link may explain it better.
    While these are intended to capture all downloads, another way is to change your download link to trigger the “event”.
    You can also add a custom class to your download links and use a script like this to trigger the event:

    function track_comment(){
    ?>
    <script>
    $('.form-submit .submit[type="submit"]').on('click', function() {
              ga('send', 'event', 'button', 'click', 'comment');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'track_comment');

    this example was used to track comment submitions, so please adjust to suit.

    Best regards,
    Mike

    #1092952

    Hey,

    Thank you for your answer. Then I have to write the download support ;)
    Thanks again

    Erdrol

    #1092955

    Hi,
    Yes this is correct.

    Best regards,
    Mike

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