diff options
author | diosmosis <benaka@piwik.pro> | 2015-06-22 13:37:04 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-06-22 13:37:04 +0300 |
commit | 9a2bed77dab4d7354bcc30500035f57298c462fd (patch) | |
tree | bcf2656a0fd927a0b638dbf5ba1973e9aca4b7c5 /plugins/UserCountryMap | |
parent | fbf938c2149ac3e4be144591eb6a3e0ce169e451 (diff) |
Use format_metrics instead of showRawMetrics in visitor map JS. This means getting numeric values from Piwik and formatting in JS, instead of getting intermediate metrics, calculating numeric metrics and then formatting in JS.
Diffstat (limited to 'plugins/UserCountryMap')
-rw-r--r-- | plugins/UserCountryMap/javascripts/visitor-map.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/UserCountryMap/javascripts/visitor-map.js b/plugins/UserCountryMap/javascripts/visitor-map.js index 70d5aba3a8..212ef5ec14 100644 --- a/plugins/UserCountryMap/javascripts/visitor-map.js +++ b/plugins/UserCountryMap/javascripts/visitor-map.js @@ -96,7 +96,8 @@ apiModule: module, apiAction: action, filter_limit: -1, - limit: -1 + limit: -1, + format_metrics: 0 }); if (countryFilter) { $.extend(params, { @@ -701,7 +702,7 @@ // load data from Piwik API ajax(_reportParams('UserCountry', 'getRegion', UserCountryMap.countriesByIso[iso].iso2)) .done(function (data) { - convertBounceRatesToInts(data); + convertBounceRatesToPercents(data); loadingComplete(); @@ -832,7 +833,7 @@ // get visits per city from API ajax(_reportParams('UserCountry', 'getCity', UserCountryMap.countriesByIso[iso].iso2)) .done(function (data) { - convertBounceRatesToInts(data); + convertBounceRatesToPercents(data); loadingComplete(); @@ -1125,7 +1126,7 @@ // now load the metrics for all countries ajax(_reportParams('UserCountry', 'getCountry')) .done(function (report) { - convertBounceRatesToInts(report); + convertBounceRatesToPercents(report); var metrics = $$('.userCountryMapSelectMetrics option'); var countryData = [], countrySelect = $$('.userCountryMapSelectCountry'), @@ -1226,11 +1227,11 @@ $$('.widgetUserCountryMapvisitorMap .widgetName span').remove(); $$('.widgetUserCountryMapvisitorMap .widgetName').append('<span class="map-title"></span>'); - // converts bounce rate percents to strings, eg, 12% => 12 - function convertBounceRatesToInts(report) { + // converts bounce rate quotients to numeric percents, eg, .12 => 12 + function convertBounceRatesToPercents(report) { $.each(report.reportData, function (i, row) { if (row['bounce_rate']) { - row['bounce_rate'] = parseInt(row['bounce_rate']); + row['bounce_rate'] = parseFloat(row['bounce_rate']) * 100; } }); } |