I have a google event tag script that needs to be added to the header of several thank you pages. I want to know how would I go about doing this. This is the code that I’ve put together and added to functions.php, but it keeps breaking the site.
add_action( 'wp_head', 'ga_leadconversion_insertion’);
function ga_leadconversion_insertion() {
if (is_page(5163) || is_page(3098) || is_page(3353) || is_page(3308) || is_page(4777) || is_page(4891) || is_page(3158)
|| is_page(3328) || is_page(3321)) {
<script> gtag('event', 'conversion', {'send_to': 'AW-852688950/MPrtCIvcyHsQtoDMlgM'});
</script>
This is the script tag I need to add to the header of specific pages on my site.
<script> gtag('event', 'conversion', {'send_to': 'AW-852688950/MPrtCIvcyHsQtoDMlgM'});
</script>
How would I be able to add this event snippet to multiple specific page headers?
