Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions dist/videojs.ga.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* videojs-ga - v0.4.1 - 2014-06-06
* videojs-ga - v0.4.1 - 2014-06-09
* Copyright (c) 2014 Michael Bensoussan
* Licensed MIT
*/
Expand Down Expand Up @@ -102,13 +102,23 @@
};
sendbeacon = function(action, nonInteraction, value) {
if (window.ga) {
ga('send', 'event', {
'eventCategory': eventCategory,
'eventAction': action,
'eventLabel': eventLabel,
'eventValue': value,
'nonInteraction': nonInteraction
});
if (dataLayer) {
dataLayer.push({
'event': eventCategory,
'eventAction': action,
'eventLabel': eventLabel,
'eventValue': value,
'nonInteraction': nonInteraction
});
} else {
ga('send', 'event', {
'eventCategory': eventCategory,
'eventAction': action,
'eventLabel': eventLabel,
'eventValue': value,
'nonInteraction': nonInteraction
});
}
} else if (window._gaq) {
_gaq.push(['_trackEvent', eventCategory, action, eventLabel, value, nonInteraction]);
} else {
Expand Down
4 changes: 2 additions & 2 deletions dist/videojs.ga.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions src/videojs.ga.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,21 @@ videojs.plugin 'ga', (options = {}) ->
sendbeacon = ( action, nonInteraction, value ) ->
# console.log action, " ", nonInteraction, " ", value
if window.ga
ga 'send', 'event',
'eventCategory' : eventCategory
'eventAction' : action
'eventLabel' : eventLabel
'eventValue' : value
'nonInteraction' : nonInteraction
if dataLayer
dataLayer.push(
'event' : eventCategory
'eventAction' : action
'eventLabel' : eventLabel
'eventValue' : value
'nonInteraction' : nonInteraction
)
else
ga 'send', 'event',
'eventCategory' : eventCategory
'eventAction' : action
'eventLabel' : eventLabel
'eventValue' : value
'nonInteraction' : nonInteraction
else if window._gaq
_gaq.push(['_trackEvent', eventCategory, action, eventLabel, value, nonInteraction])
else
Expand Down