Shot on goal (ice hockey)
A shot that is deflected wide or blocked by an opponent does not count as a shot on goal, rather it is recorded as a blocked shot. The player who blocks the shot is credited with a 'blocked shot', and the player who shoots the puck is credited with an 'attempt blocked'.
Shots that sail wide or high of the net and shots that hit the goalpost or crossbar are not counted as shots on goal, rather they are counted as 'missed shots'. Additionally, if a goaltender stops a puck that is going wide or high anyway, it is recorded as a 'missed shot'. Since it is not counted as a shot on goal, the goaltender does not get credit for a save.
An attempted shot that hits the pipe framing the goal mouth is not counted as a shot on goal unless the puck goes into the goal without further contact from the team attempting the shot.
A puck that is not shot with the intention of scoring (dump in, deflected pass), and ends up stopped by the goalie, should not be counted as a shot on goal.
Shots on net
A shot on goal is any touch of the puck towards the net that if not for the goal tender interviening would result in a goal.
Blocked shots don't count. If someone shoots the puck and it's tipped only the "tip" counts as a shot the original shot becomes a "pass".
If a clearing attempt from the other team ends up on net it should be a shot on goal. If someone swats at a rebound and sends it toward the net it should be a shot on goal. clearing attempts that end up on net should most definitely count and most scorer's will count them.
The only place where it really gets tricky is when you have a partially blocked shot, or a tipped shot that was on net and is tipped off net. Those situations are not supposed to be counted as shots on goal as only the "final" touch is a "shot" and the final touch sent those pucks wide.
Wrap arounds and stuff attempts can be an issue. If the goalies pad blocks a wrap around before he get's around far enough than the puck would go "across" the crease instead of into the net. Therefore, it shouldn't be regarded as a shot on goal. That's one of the trickier scenarios.