How to catch the "logout" in a script?

This construct in my ~/.profile
[color=green]trap ’
#Do something at logout
’ 0
catches if one types “exit” from the shell, but not if one issues the “logout”. Why?

How do I modify ~/.profile to catch the "logout"s too?

QOR people advised me to try adding this:
[color=green]alias logout=exit
into my ~/.profile.

Gone testing…