On Fri, 11 Dec 2009 00:20:02 +0100 Ivan Sergio Borgonovo mail@webthatworks.it wrote:
On Thu, 10 Dec 2009 23:13:44 +0200 Fred Jones fredthejonester@gmail.com wrote:
I'd like to track access to pages with certain parameters in the urls.
Google Analytics?
I'm already using Google Analytics (and related drupal module). I'll give a look to piwik, since I'd prefer not to share my data with Google (there should be a piwik module too).
But it seems it doesn't suit:
- I'd like to use it for affiliates
- I'd like to use it to track advertisement campaign and offer an interface to build them
- I'd like to avoid js
I decided to write something of my own. The idea was I want to track hit history that took to an event. I don't want to track all hits, but just selected ones containing a parameter in the url.
I'd like to build up a sort of API.
Several modules *may* trigger "events" (events looks like "actions" in D6 somehow). Modules *may* provide advanced event logging (extra data).
Part of the problems are in these *may*.
That may imply an abuse of "function_exists". Another problem is turning on and off extra data logging.
Currently I have a function that "relate" hit history to events.
function tracky_event() { $args = function_get_args(); $event = array_shift($args); // save and return eventid // ... $args = array_unshift($args, $eventid); module_invoke_all('tracky_'.$event, $args); }
Now I can build for each module/event an additional module that will log extra data and have install/uninstall function for tables that will store extra data.
Now I could define the extra data logging modules in other modules so that table creation and extra logging becomes optional.
I got this working but: - I didn't get rid of the function_exists problem if I really want to make my modules optionally dependent on the general tracking module. - naming of hooks and modules is going to be a pain - having finer control on what events I want to log with more details a) requires a module for each module/hook b) hand made install/uninstall function for each event I'd like to track
Is there something I miss that drupal offers that could make all this cleaner?