These rare earth neodymium magnets are very strong and must be secured well in order to stay in place. One of the best ways to do this is to use a 2 part epoxy.
Note: Neodymium magnets should be kept out of the reach of young children, as they are dangerous if swallowed.