Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendbeacon "percentsPlayedInterval" instead of "percent" #32

Open
Barri-G opened this issue Jul 18, 2016 · 3 comments
Open

sendbeacon "percentsPlayedInterval" instead of "percent" #32

Barri-G opened this issue Jul 18, 2016 · 3 comments

Comments

@Barri-G
Copy link

Barri-G commented Jul 18, 2016

Hi.

As a videojs user now I need to get some information about "percent played" on some of my websites.

I've tried your code and it works, but I think the way it sends the percent played is not the easiest way to understand the information; I mean, when somebody plays 10% I get 10 as a value on my analytics. But if the video continues playing and reach 20% then "percent" = 20 is sent, so analytics shows "30" (10+20). I think the script should send 10 always if "percentplayedinterval" is set to 10. I was thinking about changing this piece of code

  for percent in [0..99] by percentsPlayedInterval
      if percentPlayed >= percent && percent not in percentsAlreadyTracked

        if "start" in eventsToTrack && percent == 0 && percentPlayed > 0
          sendbeacon( 'start', true )
        else if "percentsPlayed" in eventsToTrack && percentPlayed != 0
          sendbeacon( 'percent played', true, percent)

to this:

  for percent in [0..99] by percentsPlayedInterval
      if percentPlayed >= percent && percent not in percentsAlreadyTracked

        if "start" in eventsToTrack && percent == 0 && percentPlayed > 0
          sendbeacon( 'start', true )
        else if "percentsPlayed" in eventsToTrack && percentPlayed != 0
          sendbeacon( 'percent played', true, percentsPlayedInterval)

but before doing it I'd like to know if I'm omitting anything important, because you chase to use "percent" instead of "percentsPlayedInterval" on "sendbeacon" and probably you have your reasons.

Thank you for your time and your great project.

@devkinetic
Copy link

Just my two cents. We set percentsPlayedInterval to 70 and setup goal in GA. Since anything above 51 will only be triggered once per video play.

@chrisbbreuer
Copy link

@devkinetic which VJS version do you use?

@devkinetic
Copy link

The latest, with #33 applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants