Measure how high from the floor you wish to place the sensor. Mounting it high or low will make it less obtrusive, but place it high enough up that it will not be kicked accidentally or otherwise disturbed.
Make a mark with a pencil on the door frame. Put on safety glasses. Line the sensor up on the door frame and make pencil marks where the screws must go in the frame, if your model requires screws. If your model attaches via an adhesive strip -- many micro sensors do -- you can skip this step.
Drill pilot holes for the screws, using the pencil marks you made to guide you. Place the sensor back on the door frame and install the screws to secure it.
Place the smaller piece, that is the magnet, on the door. Line this up with the sensor. Make a pencil mark at the top and bottom of the piece so you will know where to place it.
Remove the adhesive strip to expose the adhesive backing, or use double-sided tape, and press the magnet in place.
Put on safety glasses. Place the sensor on the window frame. Make pencil marks where the screws must go, if applicable.
Drill pilot holes for the screws. Place the sensor back in place and screw it securely to the window frame.
Place the magnet piece on the window sash near the sensor, aligning it. Make a pencil mark so you remember exactly where to place it.
Remove the adhesive strip backing from the magnet piece, or use double-sided tape, and press the magnet firmly in place.