TV Squared Test
by Ryan Brackett
HTML
<div class="btn">
Click me
</div>
CSS
.btn {
background-color: #4CAF50;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-family: Arial;
cursor: pointer;
border-radius: 3px;
}
.btn:active {margin-top: 2px;}
JavaScript
$(".btn").on("click", function() {
var _tvq = window._tvq = window._tvq || [];
(function() {
var session = {
'user': '<USERREF>'
};
var actionname = 'bookanappointment';
var action = {
'rev': '<REVENUE>',
'prod': '<PRODUCT>',
'id': '<ACTIONID>',
'promo': '<PROMOCODE>'
};
var u = (("https:" == document.location.protocol) ? "https://collector-11026.tvsquared.com/" : "http://collector-11026.tvsquared.com/");
_tvq.push(['setSiteId', "TV-8181907236-1"]);
_tvq.push(['setTrackerUrl', u + 'tv2track.php']);
_tvq.push([function() {
this.setCustomVariable(5, 'session', JSON2.stringify(session), 'visit')
}]);
_tvq.push([function() {
this.setCustomVariable(5, actionname, JSON2.stringify(action), 'page')
}]);
_tvq.push(['trackPageView']);
var d = document,
g = d.createElement('script'),
s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.defer = true;
g.async = true;
g.src = u + 'tv2track.js';
s.parentNode.insertBefore(g, s);
})();
});