Last active
April 1, 2016 09:46
-
-
Save sadraskol/aa0f6e539e0a9d912a78fe592cd8b929 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bookable yoid="56167d3de4b09d3daa624cea" class="medium-insert-bookable medium-insert-bookable-wide" data-href="/stories/emily-crook/most-epic-destinations-for-crazy-spring-break-in-2016/5705/activities/ACT3013"> | |
<figure data-click="/stories/emily-crook/most-epic-destinations-for-crazy-spring-break-in-2016/5705/activities/ACT3013" data-mp-event="Clicked Book Now" data-mp-type="BookableActivity" data-mp-url="/stories/emily-crook/most-epic-destinations-for-crazy-spring-break-in-2016/5705/activities/ACT3013" gtm-action="Navigate to Activity Page" gtm-category="Story Page" gtm-click="" gtm-label="Clicked Hotel Image from Story"> | |
<img src="https://yonderbound.imgix.net/uploads/bookable_activity/pictures/95ce22f3-a116-4b10-9d12-465a1c4d4d19/img_1444314429422.jpg?ixlib=rails-1.1.0&w=600&h=380&fit=crop&crop=entropy&fm=pjpg&s=35e41823eb8fca3f60df9bd7a6f81891"> | |
</figure> | |
<div class="bookable-info"> | |
<div data-click="/stories/emily-crook/most-epic-destinations-for-crazy-spring-break-in-2016/5705/activities/ACT3013" data-mp-event="Clicked Book Now" data-mp-type="BookableActivity" data-mp-url="/stories/emily-crook/most-epic-destinations-for-crazy-spring-break-in-2016/5705/activities/ACT3013" gtm-action="Navigate to Activity Page" gtm-category="Story Page" gtm-click="" gtm-label="Clicked Hotel Image from Story"> | |
<header> | |
<i class="icon-tips"></i> | |
<div class="price-container">from <span class="price">$40</span></div> | |
</header> | |
<div class="description"> | |
<h3 data-click="/stories/emily-crook/most-epic-destinations-for-crazy-spring-break-in-2016/5705/activities/ACT3013" data-mp-event="Clicked Book Now" data-mp-type="BookableActivity" data-mp-url="/stories/emily-crook/most-epic-destinations-for-crazy-spring-break-in-2016/5705/activities/ACT3013" gtm-action="Navigate to Activity Page" gtm-category="Story Page" gtm-click="" gtm-label="Clicked Hotel Image from Story">Visit the Swimming Pigs on Big Major’s Spot</h3> | |
<div class="category"><span class="label label-gray">Active</span></div> | |
<div class="location" title="Bahamas"> | |
<i class="fa fa-map-marker"></i> Bahamas</div> | |
</div> | |
<footer> | |
<a class="btn btn-book-now button-lg btn-block" data-mp-event="Navigate to Activity Page" data-mp-type="BookableActivity" data-mp-url="/stories/emily-crook/most-epic-destinations-for-crazy-spring-break-in-2016/5705/activities/ACT3013" gtm-action="Navigate to Activity Page" gtm-category="Story Page" gtm-click="" gtm-label="Clicked Hotel Image from Story" href="/stories/emily-crook/most-epic-destinations-for-crazy-spring-break-in-2016/5705/activities/ACT3013" tabindex="0">Book now</a> | |
</footer> | |
</div> | |
</div> | |
</bookable> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('click', '[gtm-click]', function(e) { | |
var item = $(event.target).closest('[gtm-click]'); | |
var data = { | |
category: item.attr('gtm-category'), | |
action: item.attr('gtm-action'), | |
label: item.attr('gtm-label'), | |
value: Date.now() - window.pageLoad | |
}; | |
dataLayer.push(event: 'ga', data: data) | |
return true; | |
}); | |
$(document).on('click', '[data-mp-event]', function(e) { | |
var item = $(e.target).closest('[data-mp-event]'); | |
mixpanel.track(item.data('mp-event'), { | |
item_url: item.data('mp-url'), | |
type: item.data('mp-type') | |
}); | |
return true; | |
}); | |
$(document).on('click', '[data-href]', function(e) { | |
e.preventDefault() | |
var el = $(e.target); | |
var turbolinksEnabled = el.attr('data-no-turbolink') != 'true'; | |
if (turbolinksEnabled) { | |
Turbolinks.visit($(this).data('href')); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
code can be found on this story