Title: Uncaught SyntaxError: got &#8216;&amp;&#8217;
Last modified: March 18, 2024

---

# Uncaught SyntaxError: got ‘&’

 *  Resolved [zupaazhai](https://wordpress.org/support/users/zupaazhai/)
 * (@zupaazhai)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-got/)
 * I found issue Javascript error “**Uncaught SyntaxError: expected expression, 
   got ‘&’**” when using with Plugin **Google Analytics for WooCommerce**
 * it renders `gtag` function with HTML encoded value
 *     ```wp-block-code
       gtag(&quot;event&quot;, &quot;page_view&quot;, {send_to: &quot;GLA&quot;});
       ```
   
 * I try to deep in code of plugin, I found interesting in 2 methods in file `/src/
   Google/GoogleSiteTag.php`
 * at function `display_page_view_event_snippet` it pass value of `add_inline_event_script`
   with string `'gtag("event", "page_view", {send_to: "GLA"});'`
 *     ```wp-block-code
       private function display_page_view_event_snippet(): void {
        if ( ! is_cart() ) {
           $this->add_inline_event_script( 'gtag("event", "page_view", {send_to: "GLA"});' );
           return;
       }
       ...
       ```
   
 * then in method `add_inline_event_script` , inline script that pass as parameter
   will be wrap with function `esc_js` , so quote symbol will be rendered as `&quot;`
   then this leads to JS error.
 * I not sure is this can be defect or bug when use these plugin together? let me
   know if Developer team see this topic and anyone found out solution
 * My Environment
 * WordPress – 6.4.3
   Google Listings and Ads – 2.6.2Google Analytics for WooCommerce–
   2.0.3
    -  This topic was modified 2 years, 2 months ago by [zupaazhai](https://wordpress.org/support/users/zupaazhai/).
    -  This topic was modified 2 years, 2 months ago by [zupaazhai](https://wordpress.org/support/users/zupaazhai/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [anastas10s](https://wordpress.org/support/users/anastas10s/)
 * (@anastas10s)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-got/#post-17508674)
 * 👋 hey [@zupaazhai](https://wordpress.org/support/users/zupaazhai/)
 * Thanks for reaching out about this.
 * > I not sure is this can be defect or bug when use these plugin together? let
   > me know if Developer team see this topic and anyone found out solution
 * From what I gather, your description refers to [Google Listings & Ads](https://wordpress.org/plugins/google-listings-and-ads/)
   and [Google Analytics for WooCommerce](https://wordpress.org/plugins/woocommerce-google-analytics-integration/)
   resulting in an uncaught SyntaxError, when activated together. Correct?
 * Due to the technical nature of this, feel free to open an issue on GitHub, providing
   further details on how to reproduce, the site’s System Status Report (SSR), etc.
 * The new issue screens for the repositories can be found linked below, for your
   convenience:
    - [https://github.com/woocommerce/google-listings-and-ads/issues/new/choose](https://github.com/woocommerce/google-listings-and-ads/issues/new/choose)
    - [https://github.com/woocommerce/woocommerce-google-analytics-integration/issues/new/choose](https://github.com/woocommerce/woocommerce-google-analytics-integration/issues/new/choose)
 * I hope this is helpful! Please let us know if you have any further questions 
   about this matter, or if we misinterpret your concern in any way. We will be 
   happy to help you further.
 *  Thread Starter [zupaazhai](https://wordpress.org/support/users/zupaazhai/)
 * (@zupaazhai)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-got/#post-17513528)
 * [@anastas10s](https://wordpress.org/support/users/anastas10s/)
   this already fixed
   in version `2.6.3 - 2024-03-19`
 *     ```wp-block-code
       *** WooCommerce Google Listings and Ads Changelog ***
   
       = 2.6.3 - 2024-03-19 =
       * Fix - Handle parse JSON exception when Creating Ads Account.
       * Fix - Inline Javascript encoding for gtag events.
       * Fix - Undefined keys offers_free_shipping or free_shipping_threshold.
       ```
   
 * Thanks 🤘🔥
    -  This reply was modified 2 years, 2 months ago by [zupaazhai](https://wordpress.org/support/users/zupaazhai/).
 *  [ckadenge (woo-hc)](https://wordpress.org/support/users/ckadenge/)
 * (@ckadenge)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-got/#post-17513532)
 * Hi [@zupaazhai](https://wordpress.org/support/users/zupaazhai/),
 * Glad to hear it – thanks for letting us know!
 * I’ll mark this thread as resolved now. If you have any further questions, I recommend
   creating a new thread.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Uncaught SyntaxError: got ‘&’’ is closed to new replies.

 * ![](https://ps.w.org/google-listings-and-ads/assets/icon.svg?rev=2775988)
 * [Google for WooCommerce](https://wordpress.org/plugins/google-listings-and-ads/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-listings-and-ads/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-listings-and-ads/)
 * [Active Topics](https://wordpress.org/support/plugin/google-listings-and-ads/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-listings-and-ads/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-listings-and-ads/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [ckadenge (woo-hc)](https://wordpress.org/support/users/ckadenge/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-got/#post-17513532)
 * Status: resolved