add chartbeat option for great success (and metrics)
This commit is contained in:
parent
3b994f45e1
commit
7be7acdfd6
4 changed files with 44 additions and 0 deletions
|
|
@ -25,9 +25,42 @@ module AnalyticsHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def chartbeat_head_block
|
||||||
|
return unless chartbeat_configured?
|
||||||
|
javascript_tag("var _sf_startpt=(new Date()).getTime()")
|
||||||
|
end
|
||||||
|
|
||||||
|
def include_chartbeat
|
||||||
|
return unless chartbeat_configured?
|
||||||
|
javascript_tag do
|
||||||
|
<<-JS
|
||||||
|
var _sf_async_config = { uid: #{AppConfig[:charbeat_uid]}, domain: '#{AppConfig[:pod_url]}' };
|
||||||
|
(function() {
|
||||||
|
function loadChartbeat() {
|
||||||
|
window._sf_endpt = (new Date()).getTime();
|
||||||
|
var e = document.createElement('script');
|
||||||
|
e.setAttribute('language', 'javascript');
|
||||||
|
e.setAttribute('type', 'text/javascript');
|
||||||
|
e.setAttribute('src',
|
||||||
|
(("https:" == document.location.protocol) ? "https://a248.e.akamai.net/chartbeat.download.akamai.com/102508/" : "http://static.chartbeat.com/") +
|
||||||
|
"js/chartbeat.js");
|
||||||
|
document.body.appendChild(e);
|
||||||
|
};
|
||||||
|
var oldonload = window.onload;
|
||||||
|
window.onload = (typeof window.onload != 'function') ?
|
||||||
|
loadChartbeat : function() { oldonload(); loadChartbeat(); };
|
||||||
|
})();
|
||||||
|
JS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def google_configured?
|
def google_configured?
|
||||||
AppConfig[:google_a_site].present? && AppConfig[:google_a_site].present?
|
AppConfig[:google_a_site].present? && AppConfig[:google_a_site].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def chartbeat_configured?
|
||||||
|
AppConfig[:chartbeat_uid].present?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -19,6 +19,8 @@
|
||||||
%title
|
%title
|
||||||
= page_title yield(:page_title)
|
= page_title yield(:page_title)
|
||||||
|
|
||||||
|
= chartbeat_head_block
|
||||||
|
|
||||||
= include_base_css_framework
|
= include_base_css_framework
|
||||||
= stylesheet_link_tag 'login', 'application', 'default'
|
= stylesheet_link_tag 'login', 'application', 'default'
|
||||||
|
|
||||||
|
|
@ -73,3 +75,5 @@
|
||||||
%li= link_to t('.whats_new'), 'https://github.com/diaspora/diaspora/wiki/Changelog'
|
%li= link_to t('.whats_new'), 'https://github.com/diaspora/diaspora/wiki/Changelog'
|
||||||
%li= link_to(t('layouts.application.toggle'), toggle_mobile_path) if is_mobile_device?
|
%li= link_to(t('layouts.application.toggle'), toggle_mobile_path) if is_mobile_device?
|
||||||
= image_tag 'branding/powered_by_diaspora.png', :height => "11px", :width => "145px"
|
= image_tag 'branding/powered_by_diaspora.png', :height => "11px", :width => "145px"
|
||||||
|
|
||||||
|
= include_chartbeat
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
%link{:rel => 'apple-touch-icon', :href => '/apple-touch-icon.png'}
|
%link{:rel => 'apple-touch-icon', :href => '/apple-touch-icon.png'}
|
||||||
|
|
||||||
= og_site_name
|
= og_site_name
|
||||||
|
= chartbeat_head_block
|
||||||
|
|
||||||
%title
|
%title
|
||||||
= page_title yield(:page_title)
|
= page_title yield(:page_title)
|
||||||
|
|
||||||
|
|
@ -58,3 +60,5 @@
|
||||||
= flash_messages
|
= flash_messages
|
||||||
#container
|
#container
|
||||||
= javascript_tag "window.preLoadContent = '#{escape_javascript(yield)}'"
|
= javascript_tag "window.preLoadContent = '#{escape_javascript(yield)}'"
|
||||||
|
|
||||||
|
= include_chartbeat
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,9 @@ defaults: &defaults
|
||||||
# the site url in raw format (e.g. pikwik.examplehost.com)
|
# the site url in raw format (e.g. pikwik.examplehost.com)
|
||||||
piwik_url:
|
piwik_url:
|
||||||
|
|
||||||
|
## Chartbeat tracking
|
||||||
|
chartbeat_uid:
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
# General Pod Settings
|
# General Pod Settings
|
||||||
######################################################
|
######################################################
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue