Support » Plugin: Google Analytics for WordPress by MonsterInsights » [Plugin: Google Analytics for WordPress] Tracks downloads with WordPress username as metadata?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Solved.

    Using “Shortcode Exec PHP” plugin
    http://wordpress.org/extend/plugins/shortcode-exec-php/

    I made a shortcode [user_login] that returns:

    global $current_user;
    get_currentuserinfo();
    return $current_user->user_login;

    Looking at the standard Google Analytics link tracking code:
    http://www.google.com/support/analytics/bin/answer.py?answer=55527

    I put the shortcode [user_login] in the link:
    <a href="/file.zip" onClick="recordOutboundLink(this, '[user_login]', 'file.zip');return false;">Download</a>

    Works! Maybe this can be simplified further using settings within the plugin to add [user_login] to every link on the entire site…

    One step closer… the shortcode above isn’t handled properly when used within this plugin. This is how links turn out, more or less:

    <a onclick="javascript:_gaq.push(['_trackPageview','[user_login]/download/mysite.com/file.zip']);" href="http://mysite.com/file.zip">Download</a>
    Is there a way to edit the plugin to escapes the [user_login] shortcode?

    I think it could also work easily like this:
    <a id="[user_login]" href="/file.zip">Download</a>
    if G.A. tracks the id=”” part.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Google Analytics for WordPress] Tracks downloads with WordPress username as metadata?’ is closed to new replies.