Need to add JS Script

I’m trying to add a small js script to ‘pages with a phone number’- which honestly, I have the phone number in the top bar, so it is on every page- but I also specifically have it on the contact page. The ad agency said, “The attachment above is the code that your website manager needs to put on every page of your website that has a phone number on it. When someone clicks one of our ads it will trigger the tracking phone number and the calls will be tracked and recorded. If they click from any other link online, they will just get your normal number. Please let me know if you have any questions and also when they have added the code to your site.” and then they provided a very short .js script. What is the best way to add this in x theme?

Hello @turbineflats,

Thanks for reaching out. :slight_smile:

Please take a look at the solution mentioned in following thread.

Thanks.

Thanks- so on the child functions.php I added: // Additional Functions // ============================================================================= add_action( 'wp_head', 'add_head_script' ); function add_head_script() { ?> <script type="text/javascript" src="//cdn.calltrk.com/companies/604706569/aec753ebe30fd52c490a/12/swap.js"></script> <?php }

Does that look correct then? I wanted to be sure I understood what you were suggesting to do.

Hello @turbineflats,

Thanks for updating the thread. :slight_smile:

Yes, code is fine and it will import swap.js file to your website.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.