[dokuwiki] Re: Google Analytics plugin

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 20 Aug 2006 21:56:34 +0100

Terence J. Grant wrote:

Hey guys, new plugin:


May be of some interest to devers since it uses the concept of "plugin
that exports code for use in template", thought it's not as simple as
a one line "if fn exists call fn" like I had hoped, but close enough:

if (file_exists(DOKU_PLUGIN.'googleanalytics/code.php'))
if (function_exists('ga_google_analytics_code')) ga_google_analytics_code();

A simpler and neater solution maybe to use a custom event and an action plugin


you make a plugin to handle "TPL_NONE_GOOGLEANALYTICS" event. The event handling mechanism will load the code associated with the plugin if its there.

Any template wishing to utilize the plugin include the line

$data = null;

If a template were to trigger the event but not have the plugin the event will effectively be ignored - ie, no confusing errors generated.



-- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: