Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Migrate GA
Browse files Browse the repository at this point in the history
  • Loading branch information
shazow committed Jan 26, 2014
1 parent 34d0c6c commit 4d5bafd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
20 changes: 14 additions & 6 deletions static/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<script type="text/javascript" src="/static/js/sha1.js"></script>
<script type="text/javascript" src="/static/js/oauth.js"></script>
<script type="text/javascript" src="/static/js/jsoauthapi.js?29"></script>
<script type="text/javascript" src="/static/js/tweepsect.js?33"></script>
<script type="text/javascript" src="/static/js/tweepsect.js?34"></script>
<script type="text/javascript">
google.load("jquery", "1");
var suffers_from_ie = navigator.appVersion.indexOf('MSIE') != -1;
Expand All @@ -34,13 +34,17 @@

if(OAuth.accessor == undefined) {
$("#login").click(function() { OAuth.auth_redirect(); }).show();
try { _gat._getTracker("UA-407051-5")._trackPageview(); } catch(err) {}
ga('send', 'pageview');
} else {
$("#tweepsect_input").show();
$("#logout").click(function() { clear_cookies(); window.location.href = '/'; }).show();
log("Welcome! You're authenticated and ready to go, pick a Twitter user to inspect.");
try { _gat._getTracker("UA-407051-5")._trackPageview("/authed"); } catch(err) {}
ga('send', 'pageview', '/authed');
}

$("#thanks-link").click(function() {
ga('send', 'event', 'thanks', 'tweet-open');
});
});
</script>
<script type="text/javascript" src="/static/js/jquery.jsonp-2.4.0.min.js"></script>
Expand Down Expand Up @@ -145,9 +149,13 @@

</div>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-407051-5', 'auto');
</script>

<script type="text/javascript">
Expand Down
8 changes: 4 additions & 4 deletions static/js/tweepsect.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,17 +352,17 @@ function decorate_tweep(item) {
);
}

function set_thanks_text(s) {
function set_thanks_text(s, variation_label) {
var href = 'https://twitter.com/home?status=' + encodeURI(s);
$("#thanks-link").attr('href', href);
}

function show_thanks(num_mutual, num_stalking, num_stalkers) {
// "A-B test" the message, for funsies.
if (Math.random() < 0.5) {
set_thanks_text("Found my Twitter stalkers using Tweepsect (" + num_stalkers + " stalkers and " + num_mutual +" mutual friends), try it! http://tweepsect.com/");
set_thanks_text("Found my Twitter stalkers using Tweepsect (" + num_stalkers + " stalkers and " + num_mutual +" mutual friends), try it! http://tweepsect.com/", 1);
} else {
set_thanks_text("Found my " + num_stalkers + " stalkers on Twitter (and " + num_mutual + " mutual friends) by using Tweepsect, try it out! http://tweepsect.com/");
set_thanks_text("Found my " + num_stalkers + " stalkers on Twitter (and " + num_mutual + " mutual friends) by using Tweepsect, try it out! http://tweepsect.com/", 2);
}
}

Expand All @@ -383,7 +383,7 @@ function parse_username(input) {

function get_results() {
$("#intro").hide();
try { _gat._getTracker("UA-407051-5")._trackPageview("/query"); } catch(err) {}
ga('send', 'pageview', '/query');

var input = $("#username").prop("value");
if(!input) {
Expand Down

0 comments on commit 4d5bafd

Please sign in to comment.