Merge pull request #7280 from svbergerem/remove-chartbeat-and-mixpanel
Remove chartbeat and mixpanel support
This commit is contained in:
commit
f9cf844602
10 changed files with 1 additions and 105 deletions
|
|
@ -5,6 +5,7 @@
|
|||
* Make the mention syntax more flexible [#7305](https://github.com/diaspora/diaspora/pull/7305)
|
||||
* Display @ before mentions [#7324](https://github.com/diaspora/diaspora/pull/7324)
|
||||
* Simplify mentions in the publisher [#7302](https://github.com/diaspora/diaspora/pull/7302)
|
||||
* Remove chartbeat and mixpanel support [#7280](https://github.com/diaspora/diaspora/pull/7280)
|
||||
|
||||
## Bug fixes
|
||||
|
||||
|
|
|
|||
|
|
@ -126,12 +126,6 @@ var app = {
|
|||
app.flashMessages = new app.views.FlashMessages({el: $("#flash-container")});
|
||||
},
|
||||
|
||||
/* mixpanel wrapper function */
|
||||
instrument : function(type, name, object, callback) {
|
||||
if(!window.mixpanel) { return; }
|
||||
window.mixpanel[type](name, object, callback);
|
||||
},
|
||||
|
||||
setupDisabledLinks: function() {
|
||||
$("a.disabled").click(function(event) {
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
|||
app.flashMessages.handleAjaxError(response);
|
||||
}
|
||||
});
|
||||
|
||||
app.instrument("track", "Like");
|
||||
},
|
||||
|
||||
unlike : function() {
|
||||
|
|
@ -87,8 +85,6 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
|||
self.set({"likes_count" : self.get("likes_count") - 1});
|
||||
self.likes.trigger("change");
|
||||
}});
|
||||
|
||||
app.instrument("track", "Unlike");
|
||||
},
|
||||
|
||||
comment: function(text, options) {
|
||||
|
|
@ -104,8 +100,6 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
|||
self.trigger('change'); //updates after sync
|
||||
if (options.success) { options.success(); }
|
||||
});
|
||||
|
||||
app.instrument("track", "Comment");
|
||||
},
|
||||
|
||||
reshare : function(){
|
||||
|
|
@ -126,8 +120,6 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
|||
.fail(function(response) {
|
||||
app.flashMessages.handleAjaxError(response);
|
||||
});
|
||||
|
||||
app.instrument("track", "Reshare");
|
||||
},
|
||||
|
||||
userCanReshare : function(){
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
# Copyright (c) 2010-2012, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
module AnalyticsHelper
|
||||
def include_mixpanel
|
||||
include_analytics "mixpanel" do
|
||||
nonced_javascript_tag do
|
||||
<<-JS.html_safe
|
||||
(function(d,c){var a,b,g,e;a=d.createElement('script');a.type='text/javascript';a.async=!0;a.src=('https:'===d.location.protocol?'https:':'http:')+'//api.mixpanel.com/site_media/js/api/mixpanel.2.js';b=d.getElementsByTagName('script')[0];b.parentNode.insertBefore(a,b);c._i=[];c.init=function(a,d,f){var b=c;'undefined'!==typeof f?b=c[f]=[]:f='mixpanel';g='disable track track_pageview track_links track_forms register register_once unregister identify name_tag set_config'.split(' ');
|
||||
for(e=0;e<g.length;e++)(function(a){b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,0)))}})(g[e]);c._i.push([a,d,f])};window.mixpanel=c})(document,[]);
|
||||
mixpanel.init("#{AppConfig.privacy.mixpanel_uid}");
|
||||
JS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def include_mixpanel_guid
|
||||
return unless current_user
|
||||
include_analytics "mixpanel" do
|
||||
nonced_javascript_tag do
|
||||
<<-JS.html_safe
|
||||
mixpanel.name_tag("#{current_user.guid}");
|
||||
JS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def chartbeat_head_block
|
||||
return unless configured?("chartbeat")
|
||||
nonced_javascript_tag("var _sf_startpt=(new Date()).getTime()")
|
||||
end
|
||||
|
||||
def include_chartbeat
|
||||
include_analytics "chartbeat" do
|
||||
nonced_javascript_tag do
|
||||
<<-JS.html_safe
|
||||
var _sf_async_config = { uid: #{AppConfig.privacy.chartbeat_uid}, domain: "#{AppConfig.pod_uri.host}" };
|
||||
(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
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def include_analytics(service, &block)
|
||||
return unless configured?(service)
|
||||
yield block
|
||||
end
|
||||
|
||||
def configured?(service)
|
||||
AppConfig.privacy.send("#{service}_uid").present?
|
||||
end
|
||||
end
|
||||
|
|
@ -22,9 +22,7 @@
|
|||
= include_gon(camel_case: true, nonce: content_security_policy_nonce(:script))
|
||||
= yield(:javascript)
|
||||
|
||||
= chartbeat_head_block
|
||||
= csrf_meta_tag
|
||||
= current_user_atom_tag
|
||||
= include_mixpanel
|
||||
|
||||
= yield(:head)
|
||||
|
|
|
|||
|
|
@ -32,9 +32,6 @@
|
|||
|
||||
= yield :after_content
|
||||
|
||||
= include_chartbeat
|
||||
= include_mixpanel_guid
|
||||
|
||||
.blueimp-gallery.blueimp-gallery-controls#blueimp-gallery
|
||||
.slides
|
||||
%a.prev
|
||||
|
|
|
|||
|
|
@ -36,6 +36,3 @@
|
|||
%h3
|
||||
= t("streams.activity.title")
|
||||
= yield
|
||||
|
||||
= include_chartbeat
|
||||
= include_mixpanel_guid
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ defaults:
|
|||
enable: false
|
||||
host:
|
||||
site_id:
|
||||
mixpanel_uid:
|
||||
chartbeat_uid:
|
||||
statistics:
|
||||
user_counts: false
|
||||
post_counts: false
|
||||
|
|
|
|||
|
|
@ -306,12 +306,6 @@ configuration: ## Section
|
|||
#host: 'stats.example.org'
|
||||
#site_id: 1
|
||||
|
||||
## Mixpanel event tracking (disabled by default).
|
||||
#mixpanel_uid:
|
||||
|
||||
## Chartbeat tracking (disabled by default).
|
||||
#chartbeat_uid:
|
||||
|
||||
## Statistics
|
||||
## Your pod will report its name, software version and whether
|
||||
## or not registrations are open via /statistics.json.
|
||||
|
|
|
|||
|
|
@ -31,13 +31,7 @@ SecureHeaders::Configuration.default do |config|
|
|||
end
|
||||
end
|
||||
|
||||
if AppConfig.privacy.mixpanel_uid.present?
|
||||
csp[:script_src] << "api.mixpanel.com"
|
||||
csp[:connect_src] << "api.mixpanel.com"
|
||||
end
|
||||
|
||||
csp[:script_src] << "code.jquery.com" if AppConfig.privacy.jquery_cdn?
|
||||
csp[:script_src] << "static.chartbeat.com" if AppConfig.privacy.chartbeat_uid.present?
|
||||
csp[:form_action] << "www.paypal.com" if AppConfig.settings.paypal_donations.enable?
|
||||
|
||||
csp[:report_uri] = [AppConfig.settings.csp.report_uri] if AppConfig.settings.csp.report_uri.present?
|
||||
|
|
|
|||
Loading…
Reference in a new issue