[wp-hackers] Adding an output buffer callback

William Canino william.canino at googlemail.com
Mon Nov 2 04:41:00 UTC 2009


One of the features of Google Analytics and GA plugins is the ability
to track outgoing links using this technique
http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55527
.

I reviewed the various GA plugins and saw that they only run their
preg_match_replace inside a filter hook on the_content, the_excerpt
and comment_text.  This means they don't track outbound links on the
theme, the widgets, and the output of plugins.

Another thing they don't track is where people click the blog's feeds
link and how often.

I want to improve this by preg_match_replace-ing the whole page
output.  I have written a function ga_link() that modifies hyperlinks
to insert this tracking code.

I would like advice on where to best call ob_start('ga_link') and
ob_end_flush().

W


More information about the wp-hackers mailing list