mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
Remove mixpanel
(imported from commit 9b6cc58ee9be483db8bf2d2eaaaecabc14f821e4)
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
var metrics = (function () {
|
||||
|
||||
var exports = {};
|
||||
|
||||
function enable_metrics() {
|
||||
return page_params.enable_metrics;
|
||||
}
|
||||
|
||||
if (! enable_metrics()) {
|
||||
mixpanel.disable();
|
||||
}
|
||||
|
||||
function include_in_sample() {
|
||||
// Send a random sample of events that we generate
|
||||
return Math.random() < 0.1;
|
||||
}
|
||||
|
||||
function send_resize_event() {
|
||||
mixpanel.track('window resized', {height: $(window).height(),
|
||||
width: $(window).width()});
|
||||
}
|
||||
|
||||
mixpanel.register({user: page_params.email, realm: page_params.domain});
|
||||
send_resize_event();
|
||||
|
||||
$(function () {
|
||||
$(document).on('compose_started.zulip', function (event) {
|
||||
if (! include_in_sample()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mixpanel.track('compose started', {type: event.message_type,
|
||||
trigger: event.trigger});
|
||||
});
|
||||
$(document).on('narrow_activated.zulip', function (event) {
|
||||
if (! include_in_sample()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var operators = event.filter.operators();
|
||||
var stream_operands = event.filter.operands('stream');
|
||||
var subject_operands = event.filter.operands('topic');
|
||||
var reported_operators;
|
||||
if (operators.length === 1) {
|
||||
reported_operators = operators[0].operator;
|
||||
} else if (operators.length === 2
|
||||
&& stream_operands.length !== 0 && subject_operands.length !== 0) {
|
||||
reported_operators = 'stream and subject';
|
||||
} else {
|
||||
reported_operators = 'multiple';
|
||||
}
|
||||
|
||||
mixpanel.track('narrow activated', {operators: reported_operators,
|
||||
trigger: event.trigger});
|
||||
});
|
||||
|
||||
$(window).on('resize', $.debounce(3000, send_resize_event));
|
||||
});
|
||||
|
||||
return exports;
|
||||
}());
|
||||
@@ -944,12 +944,6 @@ a.bottom-signup-button {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.mixpanel-badge {
|
||||
width: 85px;
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.centered-button {
|
||||
text-align: center;
|
||||
}
|
||||
@@ -1041,12 +1035,6 @@ a.bottom-signup-button {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mixpanel-badge {
|
||||
width: 65px;
|
||||
float: none;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.footer-navigation {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
@@ -22,16 +22,6 @@
|
||||
|
||||
{% if not_enterprise %}
|
||||
<script type="text/javascript">var dropboxAppKey = "{{ dropboxAppKey }}";</script>
|
||||
{# mixpanel #}
|
||||
<script type="text/javascript">
|
||||
(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==
|
||||
typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);
|
||||
b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
|
||||
|
||||
{# You can add {verbose: true} to the second argument of #}
|
||||
{# mixpanel.init to get additional debugging information from it. #}
|
||||
mixpanel.init("{{ mixpanel_token }}", {track_pageview: {{ enable_metrics }}});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{# We need to import jQuery before Bootstrap #}
|
||||
@@ -42,9 +32,6 @@ mixpanel.init("{{ mixpanel_token }}", {track_pageview: {{ enable_metrics }}});
|
||||
var page_params = {debug_mode: false};
|
||||
</script>
|
||||
{% endblock %}
|
||||
<script type="text/javascript">
|
||||
page_params.enable_metrics = {{ enable_metrics }};
|
||||
</script>
|
||||
{% minified_js 'common' %}
|
||||
{% block customhead %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -108,9 +108,3 @@ if (window.location.hash.substring(0, 1) === "#") {
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block mixpanel_badge %}
|
||||
<li class="mixpanel-badge"><a href="https://mixpanel.com/f/partner">
|
||||
<img src="//cdn.mxpnl.com/site_media/images/partner/badge_light.png" alt="Mobile Analytics" />
|
||||
</a></li>
|
||||
{% endblock %}
|
||||
|
||||
@@ -66,9 +66,6 @@ hence the name.
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{# We only want the mixpanel badge on the front page #}
|
||||
{% block mixpanel_badge %}
|
||||
{% endblock %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Global variables, categorized by place of definition.
|
||||
var globals =
|
||||
// Third-party libraries
|
||||
' $ _ jQuery Spinner Handlebars XDate zxcvbn Intl mixpanel Notification'
|
||||
' $ _ jQuery Spinner Handlebars XDate zxcvbn Intl Notification'
|
||||
+ ' LazyLoad Dropbox SockJS marked'
|
||||
|
||||
// Node-based unit tests
|
||||
|
||||
@@ -29,7 +29,5 @@ def add_settings(request):
|
||||
|
||||
def add_metrics(request):
|
||||
return {
|
||||
'mixpanel_token': settings.MIXPANEL_TOKEN,
|
||||
'enable_metrics': ujson.dumps(settings.DEPLOYED),
|
||||
'dropboxAppKey': settings.DROPBOX_APP_KEY
|
||||
}
|
||||
|
||||
@@ -90,8 +90,6 @@ if DEPLOYED and not ENTERPRISE:
|
||||
S3_BUCKET="humbug-user-uploads"
|
||||
S3_AUTH_UPLOADS_BUCKET = "zulip-user-uploads"
|
||||
S3_AVATAR_BUCKET="humbug-user-avatars"
|
||||
|
||||
MIXPANEL_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
else:
|
||||
S3_KEY="xxxxxxxxxxxxxxxxxxxx"
|
||||
S3_SECRET_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
@@ -99,7 +97,6 @@ else:
|
||||
S3_AUTH_UPLOADS_BUCKET = "zulip-user-uploads-test"
|
||||
S3_AVATAR_BUCKET="humbug-user-avatars-test"
|
||||
|
||||
MIXPANEL_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
LOCAL_DATABASE_PASSWORD="xxxxxxxxxxxx"
|
||||
|
||||
# Twitter API credentials
|
||||
|
||||
@@ -269,7 +269,6 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
|
||||
'S3_SECRET_KEY': '',
|
||||
'S3_BUCKET': '',
|
||||
'S3_AVATAR_BUCKET': '',
|
||||
'MIXPANEL_TOKEN': '',
|
||||
'MAILCHIMP_API_KEY': '',
|
||||
'LOCAL_UPLOADS_DIR': None,
|
||||
'DROPBOX_APP_KEY': '',
|
||||
@@ -602,11 +601,6 @@ JS_SPECS = {
|
||||
|
||||
app_srcs = JS_SPECS['app']['source_filenames']
|
||||
|
||||
if MIXPANEL_TOKEN:
|
||||
# Mixpanel is not used on enterprise and throws an error when the
|
||||
# library is not included
|
||||
app_srcs.append('js/metrics.js')
|
||||
|
||||
PIPELINE_JS = {} # Now handled in tools/minify-js
|
||||
PIPELINE_JS_COMPRESSOR = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user