Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Cordula

    (@cordula)

    P.S.
    Google-analytics tracks my site, but not the events of downloading…

    That’s right…
    I’ve added onclick to <a href but it’s wiped out in the frontend… ;(

    onClick="_gaq.push(['_trackEvent', 'download-%file_extension%', '%file_extension%', '%uid% - %file_extension% - %file_display_name% - %file_name% - %file_category% - %file_post_url%']);"

    I’ve done this. Just edit wp-filebase\classes\TplLib.php file and comment out the remove action. ??

    // remove existing onclicks
    //	$tpl = preg_replace(array('/<a\s+([^>]*)onclick=".+?"\s+([^>]*)href="%file_url%"/i', '/<a\s+([^>]*)href="%file_url%"\s+([^>]*)onclick=".+?"/i'), '<a href="%file_url%" $1$2', $tpl);

    Then you can add onclick functions to the template.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom JavaScript download tracking (e.g. Google Analytics)’ is closed to new replies.