//= require openlayers
//= require i18n/translations
//= require globals
+//= require piwik
//= require browse
//= require export
//= require map
OSM = {
+<% if defined?(PIWIK_LOCATION) and defined?(PIWIK_SITE) %>
+ PIWIK_LOCATION: <%= PIWIK_LOCATION.to_json %>,
+ PIWIK_SITE: <%= PIWIK_SITE.to_json %>,
+<% end %>
MAX_REQUEST_AREA: <%= MAX_REQUEST_AREA.to_json %>,
SERVER_URL: <%= SERVER_URL.to_json %>,
API_VERSION: <%= API_VERSION.to_json %>
--- /dev/null
+if (OSM.PIWIK_LOCATION && OSM.PIWIK_SITE) {
+ $(document).ready(function () {
+ var base = document.location.protocol + "//" + OSM.PIWIK_LOCATION + "/";
+
+ $.ajax({
+ url: base + "piwik.js",
+ dataType: "script",
+ cache: true,
+ success: function () {
+ var piwikTracker = Piwik.getTracker(base + "piwik.php", OSM.PIWIK_SITE);
+
+ piwikTracker.trackPageView();
+ piwikTracker.enableLinkTracking();
+
+ $("meta[name=piwik-goal]").each(function () {
+ piwikTracker.trackGoal($(this).attr("content"));
+ });
+ }
+ });
+ });
+}
<%= tag("link", { :rel => "publisher", :href => "https://plus.google.com/111953119785824514010" }) %>
<%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => asset_path("osm.xml") }) %>
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
+ <% if flash[:piwik_goal] -%>
+ <%= tag("meta", :name => "piwik-goal", :content => flash[:piwik_goal]) %>
+ <% end -%>
<%= style_rules %>
<%= yield :head %>
<%= csrf_meta_tag %>
+++ /dev/null
-<script type="text/javascript">
-var _paq = _paq || [];
-(function(){ var u="<%= request.protocol %><%= PIWIK_LOCATION %>/";
-_paq.push(['setSiteId', <%= PIWIK_SITE %>]);
-_paq.push(['setTrackerUrl', u+'piwik.php']);
-_paq.push(['trackPageView']);
-_paq.push(['enableLinkTracking']);
-<% if flash[:piwik_goal] -%>
-_paq.push(['trackGoal', <%= flash[:piwik_goal] %>);
-<% end -%>
-var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js';
-s.parentNode.insertBefore(g,s); })();
-</script>
-<noscript><p><img src="<%= request.protocol %><%= PIWIK_LOCATION %>/piwik.php?idsite=<%= PIWIK_SITE %>" style="border:0" alt="" /></p></noscript>
</div>
<% if defined?(PIWIK_LOCATION) and defined?(PIWIK_SITE) -%>
- <%= render :partial => "layouts/piwik" %>
+ <noscript><p><img src="<%= request.protocol %><%= PIWIK_LOCATION %>/piwik.php?idsite=<%= PIWIK_SITE %>" style="border:0" alt="" /></p></noscript>
<% end -%>
</body>
</html>