Advice on adding Google Tag Manager to forms with 'Text Confirmation'

Hey All

I’m looking to add a GTM conversion tracking script upon submission of a form with a text confirmation.

The script looks like this
<script> gtag('event', 'conversion', {'send_to': 'AW-834899999/-mQAQSDOkdgBEPG8i54D'}); </script>

I’ve found some more involved methods suggested, like this:

However it seems easiest to simply place the script in the confirmation text like so:

Has anyone successfully integrated GTM this way?
What is the preferred method for this?

Thanks!

In most of the instances I have seen, the script is added to the confirmation message or page. Does that work for you?