Tagged: download, GA, google analytics
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
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
Hey,
Thank you for your answer. Then I have to write the download support ;)
Thanks again
Erdrol