Connect the relay coil to something that is on when the engine is running.
A wiring diagram for your vehicle will be your best friend to figure that out.
I know in most vehicles the fan circuit is energized only with the ignition switch in the on position, so that might be a circuit worth tapping into.
Then use the relay contacts to connect the main and auxiliary batteries together when the coil is energized.
You will also want a fuse in the power conductors at both the main and the auxiliary battery. Without said fuse, you might find the wire that carries the charging current between the two batteries accidentally carrying hundreds of amps if something does not go as planned during an engine start condition.
If you want a really painless installation (for a lot more money of course)...
check out these... I am using both in my new pickup and so far they have worked well.