Tracking code - not Google Analytics

Topics: Customizing Orchard, General
Feb 18, 2014 at 11:36 AM
Hi there

Can anyone tell me please how to add tracking code on to my website? It is not Google Analytics (I already have this installed via the Google Analytics module).

Many thanks in advance,
Feb 18, 2014 at 1:32 PM

There are several different ways to do this.

Probably the easiest way to do this would be to create an HTML widget that has the javascript that does your tracking. Then put that widget on the default layer. This is a pure content management solution. IT would put your tracking code on every single page.

You could also alter one of a couple different files in your Theme (if you have a custom theme). Either the Layout.cshtml or Document.cshtml file could be tweaked to put your javascript code in there. You could also use the Shape Tracer to easily create an alternative HeadScripts view.

If you had some hacking skills and/or if you needed a bit more control over things (ie, you wanted tracking code on some pages but not others), you could create a module that has a XXX_Tracking module. That module would have your standard bits and pieces: ContentPart, Driver, Handler, Views, etc. You could then have this new content part be included on any Content Type you wanted tracking enabled for. You could probably copy the Google Analytics module and just do some tweeking.

Would need to know a bit more about your tracking code requirements to get any more detailed.


Feb 19, 2014 at 8:35 AM

Thanks Bill, that is really helpful.

As I think the tracking needs to be on every page I think I will try the widget on the default layer suggestion first.

Many thanks,