BEVERLY HILLS, Calif. - What could the Kevin Spacey political thriller "House of Cards" possibly have to do with "It's Always Sunny in Philadelphia"?

More than you might think.

Unless, that is, you're one of the Netflix subscribers whose behavior helped the streaming service make the connection in the first place.

Because it turns out that when Netflix shows us something that's supposedly like the thing we've just watched, it's not making an editorial judgment, or promoting some pet project: It's doing the math on our viewing habits.

Todd Yellin, vice president of product innovation for Netflix, doesn't like the word spying.

"Spying would be this nefarious thing that we are trying to do something against you," he told reporters last week at the Television Critics Association's summer meetings. "We are using the data on your behavior only to make your experience better."

Still, it's safe to say that if you're watching Netflix, Netflix is watching you right back, trying to figure out how to keep you as a customer by, among other things, showing you what you might want to see next.

Which brings us to "It's Always Sunny," the FXX series created by Philly's Rob McElhenney whose reruns have become a Netflix staple.

A couple of years ago, Yellin said, he was showing "House of Cards" producers David Fincher and Beau Willimon "the kinds of things people tend to watch before and after" their show.

"This is based on millions of viewers and what they really watched before and after," Yellin said. "And there was some really obvious stuff, the original British 'House of Cards,' 'West Wing,' etcetera, etcetera. . . . But then there was much less obvious stuff. When they saw 'It's Always Sunny in Philadelphia,' I'll be damned. That's similar in a more profound sense than one would imagine with 'House of Cards.' "

(Maybe you missed the "Sunny" episode where the gang murdered some people, manipulated some others and ultimately took over the White House? Me, too.)

"Millions of viewers" might not be wrong, but that's as close as Yellin, who lives in a world of data-driven algorithms, will get to talking about actual numbers.

"I do know how many people watch this stuff. You'd have to put me on a stretch rack, and it would get really ugly to get that information out of me because we don't want people to get distracted with the numbers," he said, in what might possibly be the funniest explanation ever for Netflix's refusal to discuss ratings.

"Movies and TV shows become more like a sports score to people watching, as opposed to, 'Is this thing good? Is this something I'm going to enjoy?' " he said.

Netflix show producers, including Upper Darby's Tina Fey ("Unbreakable Kimmy Schmidt") and Broomall's Marta Kauffman ("Grace and Frankie") make it clear that they don't miss the Nielsens. ("With social media, you get a whole new way of finding out who is watching," said Kauffman. "And it's so much better than ratings, because you actually get a sense of the enthusiasm.")

"Longmire," whose fourth season debuts on Netflix Sept. 10, was canceled last year by A&E because, as the Wall Street Journal reported at the time, the Wyoming-set crime drama starring Robert Taylor as a widowed sheriff had the "wrong" viewers for the cable network - an audience larger than AMC's "Mad Men," but one that skewed considerably older than most advertisers like.

"We had an audience of very, very passionate fans . . . that had basically been disqualified because they were not seen as sexy to advertisers," executive producer Greer Shephard said.

That shouldn't be a problem at commercial-free Netflix, as long as fans follow it there.

And after sweating out a third-season cliffhanger that might have left them hanging permanently, "Longmire" viewers can look forward to seeing more in each of 10 episodes than they did before.

"One of the biggest differences about our new environment, our new home, is that we're not subject to the same time constraints," said co-creator Hunt Baldwin.

"In the first three seasons, we would often come in with episodes that were excellent and 52, 53 minutes long, and we had to find big cuts in those shows. And sometimes entire storylines would go out, sometimes really interesting character pieces," so they could get the show to 42 minutes to make room for commercials.

"Ironically, the theme of season 4 is . . . second chances," Shephard said.

Phone: 215-854-5950

On Twitter: @elgray

Blog: ph.ly/EllenGray