File: sync.erb

package info (click to toggle)
ruby-rack-piwik 0.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 116 kB
  • ctags: 22
  • sloc: ruby: 108; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 1,191 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!-- Piwik -->
<script type="text/javascript">
    var pkBaseURL = (("https:" == document.location.protocol) ? "https://<%= @options[:piwik_url]%>/" : "http://<%= @options[:piwik_url]%>/");
    document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
    var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", <%= @options[:piwik_id]%>);

    <%# If this is a 404 page, provide additional information to Piwik %>
    <% if @status.equal?(404) %>
        piwikTracker.setDocumentTitle('404/URL = ' +
                String(document.location.pathname + document.location.search).replace(/\//g,"%2f") +
                '/From = ' + String(document.referrer).replace(/\//g,"%2f"));
    <% end %>

    piwikTracker.trackPageView();
    piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>

<!-- Image Tracker -->
<noscript>
  <%# TODO set protocol (HTTP or HTTPS) based on the current protocol according to rack logic %>
  <img src="http://<%= @options[:piwik_url] %>/piwik.php?idsite=<%= @options[:piwik_id] %>&amp;rec=1" style="border:0" alt="" />
</noscript>
<!-- End Piwik -->