refactor to add template inheritance for preparation of piwik