Skip to content

Commit

Permalink
Added extra event tracking to site analytics.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomakehurst committed Jul 11, 2016
1 parent 0b5aef1 commit 2b470cc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
37 changes: 23 additions & 14 deletions docs-v2/_includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@
<div class="page__footer-follow">
<ul class="social-icons">
{% if site.data.ui-text[site.locale].follow_label %}
<li><strong>{{ site.data.ui-text[site.locale].follow_label }}</strong></li>
<li><strong>{{ site.data.ui-text[site.locale].follow_label }}</strong></li>
{% endif %}
{% if site.twitter.username %}
<li><a href="https://twitter.com/{{ site.twitter.username }}"><i class="fa fa-fw fa-twitter-square" aria-hidden="true"></i> Twitter</a></li>
<li><a href="https://twitter.com/{{ site.twitter.username }}"><i class="fa fa-fw fa-twitter-square" aria-hidden="true"></i> Twitter</a></li>
{% endif %}
{% if site.facebook.username %}
<li><a href="https://facebook.com/{{ site.facebook.username }}"><i class="fa fa-fw fa-facebook-square" aria-hidden="true"></i> Facebook</a></li>
<li><a href="https://facebook.com/{{ site.facebook.username }}"><i class="fa fa-fw fa-facebook-square" aria-hidden="true"></i> Facebook</a></li>
{% endif %}
{% if site.author.github %}
<li><a href="http://github.com/{{ site.author.github }}"><i class="fa fa-fw fa-github" aria-hidden="true"></i> GitHub</a></li>
<li><a href="http://github.com/{{ site.author.github }}"><i class="fa fa-fw fa-github" aria-hidden="true"></i> GitHub</a></li>
{% endif %}
{% if site.author.bitbucket %}
<li><a href="http://bitbucket.org/{{ site.author.bitbucket }}"><i class="fa fa-fw fa-bitbucket" aria-hidden="true"></i> Bitbucket</a></li>
<li><a href="http://bitbucket.org/{{ site.author.bitbucket }}"><i class="fa fa-fw fa-bitbucket" aria-hidden="true"></i> Bitbucket</a></li>
{% endif %}
<li><a href="{{ base_path }}/feed.xml"><i class="fa fa-fw fa-rss-square" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].feed_label }}</a></li>
</ul>
</div>

<div class="page__footer-copyright">&copy; {{ site.time | date: '%Y' }} {{ site.name | default: site.title }}. {{ site.data.ui-text[site.locale].powered_by }} <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> &amp; <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
<div class="page__footer-copyright">&copy; {{ site.time | date: '%Y' }} {{ site.name | default: site.title }}. {{ site.data.ui-text[site.locale].powered_by }} <a href="http://jekyllrb.com"
rel="nofollow">Jekyll</a> &amp; <a
href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.
</div>

<div id="dialog" style="display: none">
<h2 class="mocklab-popup__title">Looking for super-quick hosted mocks? Try MockLab</h2>
Expand All @@ -35,30 +38,36 @@ <h2 class="mocklab-popup__title">Looking for super-quick hosted mocks? Try MockL
document.cookie = "mocklab_notification_seen=true;expires=" + expiresDate.toGMTString() + ";path=/";
}

if (!document.cookie.includes('mocklab_notification_seen')) {
window.onload = function() {
window.setTimeout(function() {
window.onload = function () {
$("a[title='MockLab']").click(function() {
_gaq.push(['_trackEvent', 'primary_nav', 'mocklab_clicked', 'MockLab clicked', 1]);
});

if (!document.cookie.includes('mocklab_notification_seen')) {
window.setTimeout(function () {
$("#dialog").dialog({
dialogClass: 'mocklab-popup',
draggable: false,
resizable: false,
modal: true,
show: {
effect: 'fade',
duration: 1000
effect: 'fade',
duration: 1000
},
buttons: [{
class: 'mocklab-popup__confirm-button',
text: "Learn More",
click: function() {
click: function () {
_gaq.push(['_trackEvent', 'mocklab_popup', 'learn_more_clicked', 'Learn More clicked', 1]);
window.location.href = "http://get.mocklab.io"
}
}]
});

setNotificationSeenCookie();
_gaq.push(['_trackEvent', 'mocklab_popup', 'mocklab_popup_seen', 'MockLab popup seen', 0]);
}, 500);
};
}

}
};
</script>
4 changes: 2 additions & 2 deletions docs-v2/_includes/masthead.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
{% endif %}

{% if link.new_window %}
<li class="masthead__menu-item"><a href="{{ domain }}{{ link.url }}" target="_blank">{{ link.title }}</a></li>
<li class="masthead__menu-item"><a href="{{ domain }}{{ link.url }}" title="{{ link.title }}" target="_blank">{{ link.title }}</a></li>
{% else %}
<li class="masthead__menu-item"><a href="{{ domain }}{{ link.url }}">{{ link.title }}</a></li>
<li class="masthead__menu-item"><a href="{{ domain }}{{ link.url }}" title="{{ link.title }}">{{ link.title }}</a></li>
{% endif %}

{% endfor %}
Expand Down

0 comments on commit 2b470cc

Please sign in to comment.