Different Links/Videos based on Visitor's Country (2 posts)

  1. BloggerDave
    Posted 1 year ago #

    Hi, I embed youtube video in my wordpress blogs, but since Youtube videos are blocked in some countries, I also put the videos on my own server. However, this means that on the same post, I would show 2 links/videos: one from youtube, and another from my server.

    Is there anyway I can detect what country the visitor is from and then show just one link to the correct video?

    The reason I don't want to show both is they don't look good and also I don't want visitors who can use youtube to use my server video because that will use up my limited bandwidth.

    Thanks in advance for any help/suggestion!

  2. Rod Whiteley
    Posted 1 year ago #

    I suppose YouTube uses a geoIP database or service to identify the country of the connection to YouTube. If you search the Internet you will find several geoIP databases and services.

    They do not tell you where the visitor is from, only where the visitor is connecting to your website from. For example, a person from China might be in a hotel in the UK, connecting through an ISP in France to a proxy in Australia. Your website (and YouTube) will only know about the connection from Australia.

    Perhaps a better way is to use JavaScript code to detect dynamically when YouTube blocks the video, but I do not know whether that is possible.

Topic Closed

This topic has been closed to new replies.

About this Topic