Mounting a sensor to the toilet flush button can be very useful. We use it to operate a fan after flushing the toilet.
A reed switch mounted to the flush button wasn’t working. I tried and could not get a switch mounted and operating reliably.
I found a different solution. Sure Electronics sells water level sensors that work using a float. They can be had in horizontal and angled versions. You can also find them easily on eBay and Aliexpress.
The float is operated by the water level in the reservoir. Our toilet fan is switched on and off by the actual water level so it will be on longer if you flush more water.
To mount the Float Sensor, an aluminium strip is used. Connecting the sensor to a converted DS10A completed the installation.