Developer forum

Forum » Development » Hooking into Statistics with your own modules

Hooking into Statistics with your own modules


Reply
Hi there,

Is there a way to register usage of your own custom modules with the Statistics module, similarly to how existing modules do it?

I've seen the API documentation on statistics, but a) it's an extremeley short and simplified example and b) it seems to enable statistics not supported by DW out of the box while I am looking for a simple solution to reuse existing functionality.

Thanks,


Imar

Replies

 
Reply
Hi Imar,

This should work for the logging part:

Dynamicweb.Frontend.StatisticsObject stat = new Dynamicweb.Frontend.StatisticsObject("[ModuleSystemName]", "[id of element]");

However, I'm not sure if the statistics module is capable of displaying statistics data from a custom module. Anyways, data are stored in the StatV2Object table, and please note that the Statv2ObjectType field that contains the module system name has a limit of 10 characters ny default.

Hope you're doing great:)

BR.
Lars
 
Reply
Hi Lars,

Yes, I am doing great, thank you.

Also thanks for the warning on the column length. If the module name is too long, it simply doesn't log. Wouldn't have found out why otherwise. That also nicely changed my module name from CustomHello to CustomHell ;-)
Also, I thought I needed to call stat.Log but then it logs twice. It seems that the overloaded constructor already logs (as your example showed).

And no, custom modules don't show up unfortunately. I tried to implement my own StatisticsProvider but that works for eCom only. So, while I could display module statistics for my own module using a StatisticsProvider, it requires eCom and displays the statistics at a very odd place.

Is it possible to somehow hook into the standard CMS statistics?

Imar
 
Reply
Haha, CustomHell :-)

Unfortunately, the statistics menu is as hard coded as it could pussibly be (check out Admin\Module\StatisticsV3\IFTree.aspx), so there's no way of affecting this unless you do something really nasty to this file.

BR.
Lars

 

You must be logged in to post in the forum