Kunal
Kunal

Reputation: 61

Pageview from connected tv or smart tv

How do I check if a user is viewing the page from a connected TV or a Smart TV using javascript. I'm also using Google analytics to log this data, is there a way I can know if pageview is from a connected TV?

Upvotes: 0

Views: 297

Answers (1)

DigTheDoug
DigTheDoug

Reputation: 1440

Depending on the TV, the browser's User-Agent string should give you some info on it. You may need to prepare a list of browsers that you are expecting to check against, but hopefully the TV's browser should contain something to the effect of "SMART-TV" in the user agent string.

You can get the string by using the BrowserDetect method in javascript:

BrowserDetect.browser

More info on BrowserDetect and its other properties here.

Upvotes: 1

Related Questions