Insert custom code in page template
-
Hello
I would like to insert some visitor tracking code (for [url=http://piwik.org/]Piwik open source analytics actually) into the <head> of each Mango html page (DGLux too, if I can).
Is this possible and if so, what's the best way to go about it?
Thanks!
-
Nice idea, this is one of the features we want to add as we upgrade the Mango UI. For now I think you could add this into the /web/WEB-INF/tags/page.tag file. I've not tried that so if it doesn't work let us know. I don't think there is anyway to do that with DGLux.
-
@JoelHaggar said:
For now I think you could add this into the /web/WEB-INF/tags/page.tag file.
Hi Joel, thanks, that worked. I expect this will get overwritten when I upgrade?
I would be happy even if I could just add the tracking code to the /dglux/login.htm page. Do you think that is possible?
Cheers
-
Excellent. You can make a copy of the new tag file and put it in overrides/web/WEB-INF/tags/page.tag and this way it won't be overwritten but you run the risk of not getting a needed update file.
You should be able to put that on the login page. You'll fine the login file under web/modules/dglux/web
-
@JoelHaggar said:
You can make a copy of the new tag file and put it in overrides/web/WEB-INF/tags/page.tag and this way it won't be overwritten but you run the risk of not getting a needed update file.
I'd rather get the updated file and have everything work smoothly, so I've been making a note of my 'customisations' so that I can redo them after I upgrade.
@JoelHaggar said:
You'll fine the login file under web/modules/dglux/web
It looks like login.jsp is for the login.htm page (of course) and view.jsp is for the viewer page.
I have edited both files to include my tracking code. It works perfectly!We are about to provide some customers with access to Mango and DGLux, so this will be a fantastic way to observe when and how they use Mango.
@JoelHaggar said:
Nice idea, this is one of the features we want to add as we upgrade the Mango UI. For now I think you could add this into the /web/WEB-INF/tags/page.tag file. I've not tried that so if it doesn't work let us know. I don't think there is anyway to do that with DGLux.
I think that this will be a very useful feature (and quite easy to implement, I guess?). Note that some tracking (Google Analytics) require the snippet to be pasted before the </head> tag, and others (Piwik) require it before the </body> tag.
As an aside, I can really recommend Piwik to anyone who is looking for an alternative to Google Analytics. I use both, but Piwik offers a far superior level of detail and is easy to use, self-hosted, and free.