Let me preface by saying I do not need to use INSERT HEADERS AND FOOTERS plugin. The INSERT HEADERS AND FOOTERS plugin adds tags site-wide. I do NOT need to add site-wide tags, I need to add my conversion tags to multiple specific pages.
I have a Linkedin conversion tag script that needs to be added into the body of several specific pages, so that I can track conversions on my site. 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_body', 'linkedin_leadconversion_insertion’);
function linkedin_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 type="text/javascript">
_linkedin_data_partner_id = "114979";
</script><script type="text/javascript">
(function(){var s = document.getElementsByTagName("script")[0];
var b = document.createElement("script");
b.type = "text/javascript";b.async = true;
b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js";
s.parentNode.insertBefore(b, s);})();
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://dc.ads.linkedin.com/collect/?pid=114979&fmt=gif" />
</noscript>
<?php }
add_action('wp_body', 'add_linkedin_leadconversion_insertion');
How would I be able to add this conversion code to multiple page’s body tags?