For that, I would not bother with the opto unless you had some very specific need for isolation. If it was my project, I would use a resistor divider to get 12v=3.3v, use a TVS to keep it at 3.3 and make sure it can handle the potential for load dump - 100v maybe, then add a capacitor to filter some of the noise as close to the input as practical. Before connecting it to the Rpi, I would test to make sure the voltage never exceeds 3.3v and is not too noisy to get a reliable trigger. You will almost assuredly need some de-bounce code to clean up the signal.