You're not totally right. Shows that get viewers in the 18-49 demo get renewed. You could get really high ratings like Harry's Law did and still get canceled if your numbers in that key demo suck (only old people watched Harry's Law). Now you also need to go by online viewing numbers to. Gossip Girl got sh*t ratings in both overall and demo but stayed on the air so long becuase it was number 1 on Itunes every time a new ep dropped. Another factor that decides a shows fate is weither or not the show was made in house. Take for instance ABC. Last Man Standing is on the bubble, it will likely get canceled becuase Last Man Standing is made by Fox not ABC Studios so ABC has to pay Fox to make the show then, if it hits 100 eps Fox makes all the symdication money. If LMS was made by ABC Studios they'd likely keep it on the air for as long as it pulled in above a 1.4 in its demo.
Except that by ratings, I'm talking about the 18-49 demo. No one calls total viewers "ratings". Harry's Law got a lot of viewers, but low ratings. Personally, when I say viewers, I'm just referring to the demo.
Gossip Girl's constant renewals had more to do with it being on CW than online viewers. It also skewed heavily towards the 18-34 female demographic, which helped it out a lot. Sure, online doesn't hurt, but it usually doesn't have as much affect as people think.
And in house shows only matter if the show is in its third season on its way to syndication. If a show is getting bad ratings in its first season, it'll usually get canceled no matter what studio is backing it. And the syndication number is 88 btw. Used to be 100, but 88's now the magic number.