Intercom.

master
Nick Sergeant 2014-08-18 11:08:49 -04:00
parent c4cf6140b5
commit d8850a087a
1 changed files with 72 additions and 41 deletions

View File

@ -417,9 +417,43 @@
{% include 'snipts/snipt-edit-js-template.html' %}
</div>
{% endblock %}
{% if request.user.is_authenticated %}
{% if request.user.is_authenticated and not debug%}
<script id="IntercomSettingsScriptTag">
var intercomSettings = {
app_id: 'sajf131y',
user_id: {{ request.user.id }},
user_hash: '{{ request.user.id|intercom_sha_256 }}',
email: '{{ request.user.email }}',
created_at: {{ request.user.date_joined|date:"U" }},
custom_data: {
'snipts count': {% snipts_count_for_user %},
'profile link': 'https://snipt.net/{{ request.user.username }}/',
'is pro': window.user_is_pro,
'blog domain': '{{ request.user.profile.blog_domain }}',
'pro date': {% firstof request.user.profile.pro_date|date:"U" 'null' %},
},
widget: {
activator: '#IntercomDefaultWidget'
}
};
</script>
<script>
(function() {
function async_load() {
var s = document.createElement('script');
s.type = 'text/javascript'; s.async = true;
s.src = 'https://static.intercomcdn.com/intercom.v1.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent) {
window.attachEvent('onload', async_load);
} else {
window.addEventListener('load', async_load, false);
}
})();
</script>
{% if request.user.profile.get_account_age <= 7 or request.user.profile.is_pro %}
{% if not debug %}
{% block olark %}
<!-- begin olark code -->
<script data-cfasync="false" type='text/javascript'>/*<![CDATA[*/window.olark||(function(c){var f=window,d=document,l=f.location.protocol=="https:"?"https:":"http:",z=c.name,r="load";var nt=function(){
@ -441,7 +475,6 @@
/* custom configuration goes here (www.olark.com/documentation) */
olark.identify('9104-133-10-2665');/*]]>*/</script><noscript><a href="https://www.olark.com/site/9104-133-10-2665/contact" title="Contact us" target="_blank">Questions? Feedback?</a> powered by <a href="http://www.olark.com?welcome" title="Olark live chat software">Olark live chat software</a></noscript>
<!-- end olark code -->
{% if request.user.is_authenticated %}
<script type="text/javascript">
olark('api.visitor.updateEmailAddress', { emailAddress: '{{ request.user.email }}' });
@ -456,11 +489,9 @@
});
</script>
{% endif %}
{% endblock %}
{% endif %}
{% endif %}
{% endif %}
{% include 'analytics.html' %}