Tracking code formatting and placement

I’m attempting to implement Piwik on my website. I’m a newbie when it comes to JavaScript, and I have two questions concerning the tracking code that goes at the end of each webpage.

First, I notice that the tracking code uses , two script segments. Why is it necessary to have two? Could they be combined into one?

Second, rather than putting the inline script at the end of each page just before the tag, could it be implemented by a where tracking.js contains the tracking code.?

Thanks for any help you may be able to give.

Those two sections are two different types of trackers from my understanding. The bigger one is if the person has JS enabled. The other is if they do not and it fires off a tracking pixle. I believe it would not function properly if you combine the two unless you make a clause for it.

Also theoretically you “should” be able to do it in an external file. I have no expierence doing so, but the best way to find out how well it works for you I think would be to just give it a try on a test domain on piwik or something similar.

Thanks for the reply. I haven’t been able to get it to work in any manner, so haven’t been able to test the options for workability. Further research has come up with a number of ideas, including that isn’t supported by html5. I’ll post back here when I finally get it to work.

I have seen topics whereby others have created includes. Do a search of piwik js file via include or the like I think it needs a small tweak but is possible.