Skip to content

Instantly share code, notes, and snippets.

View jittarao's full-sized avatar

Raghavender Rao Jitta jittarao

View GitHub Profile
<!-- place this script tag after the Gist tracking code -->
<script>
// open the Messenger widget when you receive a message
document.addEventListener('gistChatReady', function () {
document.addEventListener("onGistUnreadCountChange", function(e) {
if (window.gistUnreadCount > 0 || $('.gist-messenger-iframe').css('display') === 'block') {
gist.chat("showLauncher");
} else {
gist.chat("hideLauncher");
}
<!-- place this script tag after the Gist & Segment tracking code -->
<script>
// sends logged-in user data to Gist when Segment's identify method is called
analytics.on('identify', function(event, properties, options) {
gist.identify(event ? event : '', properties);
});
// sends events to Gist when Segment's track method is called
analytics.on('track', function(event, properties, options) {
gist.track(event, properties);
{% if subscriber.country == "United States"%}
Subscribers from USA will see this
{% elsif subscriber.country == "Italy" %}
Subscribers from Italy will see this
{% else %}
Subscribers from other countries will see this
{% endif %}
<<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
iframe {
width: 100%;
height: 100vh;
padding: 0;
margin: 0;
// This callback gets executed once Gist Messenger is fully loaded and all gist.chat() API methods are available
document.addEventListener('gistChatReady', function () {
gist.chat("sidebar");
gist.chat("navigate", 'articles');
});
<script>
/* Hide Gist Messenger Launcher on page load */
gist.chat('hideLauncher');
/* open the Messenger when you receive a message */
document.addEventListener("onGistUnreadCountChange", function(e) {
if(window.gistUnreadCount > 0) {
gist.chat('open');
}
});
{% if contact.first_name != blank %}Hi {{ contact.first_name | capitalize }}, welcome back! 👋{% else %}Hi there! 👋{% endif %}
<script>
jQuery(".elementor-button").click(function() {
var gist_email = jQuery(this).closest("form").find("input[type=email]").val();
gist.identify(gist_email);
});
</script>
<style>
@media only screen and (max-width: 480px) {
.gist-messenger-bubble-iframe iframe, .gist-notification-iframe iframe, .gist-post-small-iframe iframe, .gist-prompt-iframe iframe {
bottom: 80px!important; // Change the 80px to move the Messenger vertically from bottom edge fo the screen
right: 40px!important; // Change the 40px to move the Messenger horizontally from right edge fo the screen
// left: 40px!important; // Change the 40px to move the Messenger horizontally from left edge fo the screen
}
}
</style>
<html>
<head>
<!-- Make sure jQuery is added to your website -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<style>
/* Hide Messenger bubble using CSS */
.gist-messenger-bubble-iframe {
display: none!important;
}