You want to add Google Ads tracking code into the success message because you want to send this Google Ads. Unfortunately, Contact Form 7 doesn’t allow you to add Javascript code into success messages due to security reasons.
If you want to add your Google ads code in a traditional way, you may want to follow my steps:
Warning: I highly recommend Google Tag Manager, which is easy to use. But somehow you can’t use Google Tag Manager, the method I used will help you.
// Trigger the conversion when the form is succesfully sent.
// Artical Source: https://woofocus.com/google-ads-code-cf7/
add_action("wp_head", "woofocus_google_ads_tracking_code", 10);
function woofocus_google_ads_tracking_code(){
?>
<script>
// Trigger when the submission is sent.
document.addEventListener( 'wpcf7mailsent', function( event ) {
gtag('event', 'conversion', {
'send_to': 'ACTION_ID/LABEL' // Please Change here
});
}, false );
</script>
<?php
}If you need someone to handle this for you. Please reach out to us.