Title: syntax error, unexpected &#039;
Last modified: August 31, 2016

---

# syntax error, unexpected '

 *  Resolved [Peter Berger](https://wordpress.org/support/users/petercabrinha/)
 * (@petercabrinha)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-6/)
 * Hi I trying to add a Twitter Website tag to my website. This Websitetag is for
   counting conversions from a Twitter campaign. I hoped I can use Code Snippers
   to do add the code. But I get an error message.
 * The snippet has been deactivated due to an error on line 1:
    syntax error, unexpected‘
   <‘
 * The code
    <!– Twitter single-event website tag code –> <script src=”//platform.
   twitter.com/oct.js” type=”text/javascript”></script> <script type=”text/javascript”
   >twttr.conversion.trackPid(‘nuj9y’, { tw_sale_amount: 0, tw_order_quantity: 0});
   </script> <noscript> <img height=”1″ width=”1″ style=”display:none;” alt=”” src
   =”[https://analytics.twitter.com/i/adsct?txn_id=nuj9y&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0&#8243](https://analytics.twitter.com/i/adsct?txn_id=nuj9y&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0&#8243);/
   > <img height=”1″ width=”1″ style=”display:none;” alt=”” src=”//t.co/i/adsct?
   txn_id=nuj9y&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0″ /> </noscript
   > <!– End Twitter single-event website tag code –>
 * I am pretty new to WordPress, so I might do something really studip 🙂
 * [https://wordpress.org/plugins/code-snippets/](https://wordpress.org/plugins/code-snippets/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-6/#post-7176977)
 * Hi,
 * You’re receiving this error because you are trying to use the wrong sort of snippet
   with this plugin. It’s designed to work with PHP code snippets which don’t directly
   produce output, like you might find in a plugin or a theme’s functions.php file.
 * Fortunately, there is a way to convert your HTML code into a proper PHP snippet:
 *     ```
       add_shortcode( 'twitter_conversation_count', function () { ?>
   
       <!-- Twitter single-event website tag code -->
       <script src="//platform.twitter.com/oct.js" type="text/javascript"></script>
       <script type="text/javascript">twttr.conversion.trackPid('nuj9y', { tw_sale_amount: 0, tw_order_quantity: 0 });</script>
       <noscript>
       <img height="1" width="1" style="display:none;" alt="" src="https://analytics.twitter.com/i/adsct?txn_id=nuj9y&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
       <img height="1" width="1" style="display:none;" alt="" src="//t.co/i/adsct?txn_id=nuj9y&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
       </noscript>
       <!-- End Twitter single-event website tag code -->
   
       <?php } );
       ```
   
 * As you can see, all I have done is wrapped it in a shortcode function so you 
   can just use the `[twitter_conversation_count]` shortcode in posts and pages.
   If you’d prefer to use a shorter and more meaningful name, just change the value
   in the code above.

Viewing 1 replies (of 1 total)

The topic ‘syntax error, unexpected '’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

## Tags

 * [syntax error](https://wordpress.org/support/topic-tag/syntax-error/)

 * 1 reply
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-6/#post-7176977)
 * Status: resolved