Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
709 views
in Q2A Core by
I want to use the google analytics virtual pageviews function

_gaq.push(['_trackPageview','/pagename']);

to track mark a virtual pageview whenever someone posts a comment, question or answer.  I assumed I would use the function

post_hover_button

in a custom theme to do this.  It doesn't seem to be working.

Does anyone have any ideas on how this might work?  Thanks.

1 Answer

+1 vote
by

Hello.

I've changed the function form_button_data to track when someone signs on or login. For that, i've added this code:

 

if (@$button['label']=="Log In")
{
$this->output('<INPUT'.rtrim(' '.@$button['tags']).' VALUE="'.@$button['label'].'" TITLE="'.@$button['popup'].'" TYPE="submit"'.
(isset($style) ? (' CLASS="'.$baseclass.'" onclick="_gaq.push([\'_trackEvent\',\'Log In\',\'Submit\'])" onmouseover="this.className=\''.$hoverclass.'\';" onmouseout="this.className=\''.$baseclass.'\';"') : '').'/>');
}elseif (@$button['label']=="Register")
 
{
$this->output('<INPUT'.rtrim(' '.@$button['tags']).' VALUE="'.@$button['label'].'" TITLE="'.@$button['popup'].'" TYPE="submit"'.
(isset($style) ? (' CLASS="'.$baseclass.'" onclick="_gaq.push([\'_trackEvent\',\'Register\',\'Submit\'])" onmouseover="this.className=\''.$hoverclass.'\';" onmouseout="this.className=\''.$baseclass.'\';"') : '').'/>');
}
 
else { //rest of bottons
$this->output('<INPUT'.rtrim(' '.@$button['tags']).' VALUE="'.@$button['label'].'" TITLE="'.@$button['popup'].'" TYPE="submit"'.
(isset($style) ? (' CLASS="'.$baseclass.'" onmouseover="this.className=\''.$hoverclass.'\';" onmouseout="this.className=\''.$baseclass.'\';"') : '').'/>');
 
}//endelse

Regars

...