<script>
if (typeof FB !== 'undefined'){
FB.Event.subscribe('edge.create',
function(href) {
dataLayer.push({
'event': 'SocialEvent',
'SocialNetwork': 'Facebook',
'SocialAction': 'Like',
'SocialGoalAction': href
});
dataLayer.push({
'event': 'autoEvent',
'eventCategory': 'Social',
'eventAction': {{title}},
'eventLabel': 'Facebook like'
});
}
);
}
if (typeof FB !== 'undefined'){
FB.Event.subscribe('message.send',
function(href) {
dataLayer.push({
'event': 'SocialEvent',
'SocialNetwork': 'Facebook',
'SocialAction': 'Share',
'SocialGoalAction': href
});
dataLayer.push({
'event': 'autoEvent',
'eventCategory': 'Social',
'eventAction': {{title}},
'eventLabel': 'Facebook share'
});
}
);
}
if (typeof twttr !== 'undefined') {
twttr.ready(function (twttr) {
twttr.events.bind('click', clickEventToAnalytics);
});
}
function clickEventToAnalytics() {
dataLayer.push({
'event': 'SocialEvent',
'socialNetwork': 'Twitter',
'socialAction': 'tweet',
'SocialGoalAction': window.location.href
});
dataLayer.push({
'event': 'autoEvent',
'eventCategory': 'Social',
'eventAction': {{title}},
'eventLabel': 'Twitter share'
});
}
VK.Observer.subscribe('widgets.like.liked', function(likeCount) {
dataLayer.push({
'event': 'SocialEvent',
'socialNetwork': 'Vk',
'socialAction': 'like',
'SocialGoalAction': window.location.href
});
dataLayer.push({
'event': 'autoEvent',
'eventCategory': 'Social',
'eventAction': {{title}},
'eventLabel': 'VK like'
});
});
</script>