If it's for a game that might be embarrassing to the opponent, then you should hide their name. But if you do want to include a game, you should ask them I guess.
It's totally optional though (I think), as I believe you are allowed to show a game without asking for permission, not sure though.
I've seen many people show their games without asking for permission.
Hi chess fans
; a question for you. Is it okay to post a game (I've never used the 'insert game or diagram' button/link) that I've played on the forum here, without asking my opponents permission? This would include his/her chess.com handle. I recently played a few games that had some point or other I'd like to elaborate on. For example, I recently won a game with 25 seconds left where my opponent had over eleven minutes left. Other times I've made blunders that my opponent hadn't spotted and so on. It's time consuming but I'd like to try it from time to time.