Help with js implementation
-
Dear Sirs,
Thank you by this plugin, it´s working fine!
Could you help me with an implementation of js?
I made an ‘if condition’ to call a script as below:
add_action( 'wp_head', function() { ?> <script> if(document.querySelector('.class').innerHTML.includes('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')){ // i want to insert at html the facebook pixel, as example:<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version=’2.0′;
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,’script’,’https://connect.facebook.net/en_US/fbevents.js’);
fbq(‘init’, ‘xxxxxxxxxxxxxx’);
fbq(‘track’, ‘PageView’);
</script>
<noscript>
</noscript>`}
</script>
<?php
});`It not work at HTML inserting the code, even putting an escaping at <\/script>…
Do you know how this can work?
Thanks and Regards,
Tony
The topic ‘Help with js implementation’ is closed to new replies.