Title: Implementing Javascript in a post
Last modified: September 1, 2016

---

# Implementing Javascript in a post

 *  [northstargroup](https://wordpress.org/support/users/northstargroup/)
 * (@northstargroup)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/implementing-javascript-in-a-post/)
 * I’m looking for help with a Javascript question. I’m trying to insert Javascript
   code onto a wordpress post.
    The code that needs to run is: `<SCRIPT language
   ='JavaScript1.1' SRC="https://example.com/example.example;dc_trk_aid=306750509;
   dc_trk_cid=71993047;ord=[timestamp];dc_lat=;dc_rdid=;tag_for_child_directed_treatment
   =?"></SCRIPT>`
 * From wordpress I got that to include Javascript inside a post, you need to combine
   the call to the script file with the call to the JavaScript itself. They provide
   this sample code:
 *     ```
       <script type="text/javascript" src="/scripts/updatepage.js"></script>
       <script type="text/javascript">
       <!--
       updatepage();
       //--></script>
       ```
   
 * What I need to know is how to integrate the two.

Viewing 1 replies (of 1 total)

 *  [ikaring](https://wordpress.org/support/users/ikaring/)
 * (@ikaring)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/implementing-javascript-in-a-post/#post-7512463)
 * Please check to see if it works when just putting the above code in text editor.
 * If not, check the correct path to updatepage.js.
    If the path is correct, you
   can use shortcode to add javascript even in visual editor, like [updatepate].
 * Add this code in your functions.php.
 *     ```
       function print_updatepage_js() {
       $str =  '<script type="text/javascript" src="/scripts/updatepage.js"></script><script type="text/javascript"> updatepage(); </script>';
       return $str;
       }
       add_shortcode('updatepage', 'print_updatepage_js');
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Implementing Javascript in a post’ is closed to new replies.

## Tags

 * [implementation](https://wordpress.org/support/topic-tag/implementation/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [ikaring](https://wordpress.org/support/users/ikaring/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/implementing-javascript-in-a-post/#post-7512463)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
