There are 2 trypes of thru hull ducers: One is where the ducer is inserted in a hole punched in the hull, contacting outside water, clearly visible if looking at the hull from underneath. The other is a (design intended) transom mounted ducer that has been installed inboard for safety and better WOT bottom detection.
Most of my boats have been with the latter installation. I ensure that I have a solid hull in the location, not something with balsa filler or foam flotation...solid glass or aluminum. Second the location is near the center of the boat and as close to the transom as possible. If a deep V, one could make a level platform with epoxy such that the beam shoots vertical rather than shooting off the side at the angle of the hull.....no biggie in shallow water but could matter in deep water....basically a moot point since in deep water you aren't in danger of running aground.
Attachment is via epoxy with as few bubbles as possible. You are shooting/receiving sound waves and solid objects transmit sound the best.