diff --git a/monitorix b/monitorix index 8c6df7c..419cf24 100755 --- a/monitorix +++ b/monitorix @@ -117,6 +117,8 @@ sub create_index { my $table_back_color; my $title_back_color; my $title_fore_color; + my $piwik_code = ""; + my ($piwik_url, $piwik_sid, $piwik_img); # keep backwards compatibility for v3.2.1 and less if(ref($config{theme}) ne "HASH") { @@ -143,6 +145,34 @@ sub create_index { $title_fore_color = $config{theme}->{$theme}->{title_fg}; } + # Piwik tracking code + if(lc($config{piwik_tracking}->{enabled} eq "y")) { + $piwik_url = $config{piwik_tracking}->{url} || ""; + $piwik_sid = $config{piwik_tracking}->{sid} || ""; + $piwik_img = $config{piwik_tracking}->{img} || ""; + $piwik_code = <<"EOF"; + + + + + +EOF + } + # force to only one trailing slash (my $base_url = $config{base_url}) =~ s/\/*$/\//; (my $base_cgi = $config{base_cgi}) =~ s/\/*$/\//; @@ -158,6 +188,7 @@ sub create_index {
+ $piwik_code
diff --git a/monitorix.cgi b/monitorix.cgi
index bbd20e9..9e2bdda 100755
--- a/monitorix.cgi
+++ b/monitorix.cgi
@@ -378,6 +378,37 @@ if(!$silent) {
my $title;
my $str;
+ my $piwik_code = "";
+ my ($piwik_url, $piwik_sid, $piwik_img);
+
+ # Piwik tracking code
+ if(lc($config{piwik_tracking}->{enabled} eq "y")) {
+ $piwik_url = $config{piwik_tracking}->{url} || "";
+ $piwik_sid = $config{piwik_tracking}->{sid} || "";
+ $piwik_img = $config{piwik_tracking}->{img} || "";
+ $piwik_code = <<"EOF";
+
+
+
+
+
+EOF
+ }
+
print("\n");
print("\n");
print("