Skip to content

Commit

Permalink
add a few more ad events for roku (#50)
Browse files Browse the repository at this point in the history
* add a few more ad events for roku

* clean up more ad events

* send adskipped and adended on a skip

* v1.4.0
  • Loading branch information
jsanford8 authored Aug 31, 2023
1 parent 12189bc commit 58c49f7
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/mux-analytics.brs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function init()
m.MUX_SDK_VERSION = "1.3.3"
m.MUX_SDK_VERSION = "1.4.0"
m.top.id = "mux"
m.top.functionName = "runBeaconLoop"
end function
Expand Down Expand Up @@ -544,8 +544,7 @@ function muxAnalytics() as Object
else if eventType = "Impression"
m._addEventToQueue(m._createEvent("adimpresion"))
else if eventType = "Pause"
m._addEventToQueue(m._createEvent("adpaused"))
else if eventType = "Resume"
m._addEventToQueue(m._createEvent("adpause"))
else if eventType = "Start"
if m._viewTimeToFirstFrame = Invalid
if m._viewStartTimestamp <> Invalid AND m._viewStartTimestamp <> 0
Expand All @@ -554,17 +553,22 @@ function muxAnalytics() as Object
m._viewTimeToFirstFrame = now - m._viewStartTimestamp
end if
end if
m._advertProperties = m._getAdvertProperites(data.ctx)
m._addEventToQueue(m._createEvent("adplay"))
m._addEventToQueue(m._createEvent("adplaying"))
else if eventType = "Complete"
' mark us as having another ad being played
if m._viewAdPlayedCount <> Invalid
m._viewAdPlayedCount++
end if
if m._viewPrerollPlayedCount <> Invalid
' CHECK FOR PREROLL
m._viewPrerollPlayedCount++
end if
m._advertProperties = m._getAdvertProperites(data.ctx)
m._addEventToQueue(m._createEvent("adplay"))
m._addEventToQueue(m._createEvent("adplaying"))
else if eventType = "Resume"
m._advertProperties = m._getAdvertProperites(data.ctx)
m._addEventToQueue(m._createEvent("adplay"))
m._addEventToQueue(m._createEvent("adplaying"))
else if eventType = "Complete"
m._addEventToQueue(m._createEvent("adended"))
else if eventType = "NoAdsError"
if m._Flag_FailedAdsErrorSet <> true
Expand All @@ -584,6 +588,19 @@ function muxAnalytics() as Object
m._Flag_FailedAdsErrorSet = true
end if
end if
else if eventType = "FirstQuartile"
m._addEventToQueue(m._createEvent("adfirstquartile"))
end if
else if eventType = "Midpoint"
m._addEventToQueue(m._createEvent("admidpoint"))
end if
else if eventType = "ThirdQuartile"
m._addEventToQueue(m._createEvent("adthirdquartile"))
end if
else if eventType = "Skip"
m._addEventToQueue(m._createEvent("adskipped"))
m._addEventToQueue(m._createEvent("adended"))
end if
end function

prototype.pollingIntervalHandler = function(pollingIntervalEvent) as Void
Expand Down

0 comments on commit 58c49f7

Please sign in to comment.