Skip to content

Commit

Permalink
Ads on the main page
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu Riou committed May 21, 2018
1 parent 52eb1d3 commit 63f23bc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ body {
padding:20px 0;
}
.page-header {
padding:60px 0;
padding:45px 0;
font-size:1.2em;
color: #fff;
background: #371456 url(../img/chain.svg) left center no-repeat;
Expand Down
34 changes: 34 additions & 0 deletions templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ <h1>Search the block chain</h1>
</div>

<div class="bg-white">
<div class="container">
<div class="ad">
<a id="ad-link" href="">
<img src=""/>
<span>Buy and Sell Instantly</span>
</a>
</div>
</div>

<div class="container">

<div class="row text-center">
Expand Down Expand Up @@ -175,6 +184,31 @@ <h2>Browse the Blockchain</h2>
$('.search-filter .active').removeClass('active');
});

var ads = ["piiko"];
if (ads.length > 0) {
var sites = {
piiko: "https://www.piiko.co"
};
var chosen_idx = Date.now() % ads.length;
var chosen_ad = ads[chosen_idx];
var track_url = "https://live.blockcypher.com/ads/"+chosen_ad;

$('#ad-link img').attr("src", "/static/img/" + chosen_ad + "_logo.png");
$('#ad-link').attr("href", sites[chosen_ad]);
$('#ad-link').click(function(e) {
ga('send', 'event', 'outbound', 'click', track_url, {
'transport': 'beacon',
'hitCallback': function() {
setTimeout(function() {
document.location = sites[chosen_ad];
}, 200);
}
});
e.preventDefault();
e.stopPropagation();
});
$('div.ad').show();
}
})

</script>
Expand Down

0 comments on commit 63f23bc

Please sign in to comment.