Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Oct 2012
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    using javascript to log statistics on client side

    I want to use youtube api to log some statistics about video playing on the client side
    but javascript can't create and write files on the client side,
    I need to use javascript to transfer statistics to the server side and collect statistics on the server side

    but I hope these statistics will not be transmitted via network
    can I set up a php server with sql database on the same machine where the client resides
    so I create a html5 page(with embeded youtube video and javascripts for statistics) on the server, and user browser on the same machine to visit the html5 page, then transmit the packet via localhost?

    thanks!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,537
    Thanks
    77
    Thanked 4,381 Times in 4,346 Posts
    Ummm...yes...you can do that.

    But you will only then get statistics for videos that are played by the browser on that SAME MACHINE. How much use is that to you?

    And in any case, how is this then a JavaScript question? Your PHP code could/would know which videos were requested, so why get JS involved, at all?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    Oct 2012
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    actually I'm not familiar with javascript and php
    I just want to test how youtube video quality is under a certain network condition
    so I want to log some metrics on youtube video playing
    but it is not possible for me to log them on client,so I need a server

    so you meant I can set up a server on the same machine as client ?
    are there any easier way to do this?
    thanks!

    Quote Originally Posted by Old Pedant View Post
    Ummm...yes...you can do that.

    But you will only then get statistics for videos that are played by the browser on that SAME MACHINE. How much use is that to you?

    And in any case, how is this then a JavaScript question? Your PHP code could/would know which videos were requested, so why get JS involved, at all?

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,537
    Thanks
    77
    Thanked 4,381 Times in 4,346 Posts
    Clear as mud.

    The only part of your first post that I was replying to was this:
    can I set up a php server with sql database on the same machine where the client resides
    so I create a html5 page(with embeded youtube video and javascripts for statistics) on the server, and user browser on the same machine to visit the html5 page, then transmit the packet via localhost?
    And I said, "Yes, you can do that."

    But if that's NOT what you want, then what is it you DO want?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,346
    Thanks
    11
    Thanked 589 Times in 570 Posts
    if you don't want to use a server at all, it can only be captured locally.


    if you don't have a server of your own, or don't know how to setup a server, use a free webservice instead. it's still a server, but it's already setup and ready to go.

    from javascript, you can save the data to a google spreadsheet you created.

    see Collecting survey data using js for more info
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •