Expand my Community achievements bar.

SOLVED

Facebook Pixel Code - expected an assignment or function call and instead saw an expression

Avatar

Level 2

Hi, I'm using Launch, and I keep seeing the error message 'expected an assignment or function call and instead saw an expression' for my Facebook Pixel Code.

 

Keeps showing the error below in red:

ts):n.queue.push(arguments)_};

1 Accepted Solution

Avatar

Correct answer by
Community Advisor and Adobe Champion

OK, custom code is easier for us to help with... but we will actually have to see the code... 

 

 

Now, that underscore looks odd, it might be a typo... there is no such character in the sample pixel code:

https://developers.facebook.com/docs/meta-pixel/get-started/

<!-- Facebook Pixel Code -->
<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', '{your-pixel-id-goes-here}');
  fbq('track', 'PageView');
</script>

 

Could it just be you accidentally typed in a random character into the FB code?

View solution in original post

4 Replies

Avatar

Community Advisor and Adobe Champion

Can you provide more details?

 

Are you using the FB Pixel extension? Or coding the pixel yourself via custom code?

 

I use custom code myself.. we may not have a lot of control with the extension but I will do my best to help you.

Avatar

Community Advisor

As Jen alluded to will need more of pixel code to help troubleshoot can you publish entire pixel code (then obfuscate and private elements).

Avatar

Correct answer by
Community Advisor and Adobe Champion

OK, custom code is easier for us to help with... but we will actually have to see the code... 

 

 

Now, that underscore looks odd, it might be a typo... there is no such character in the sample pixel code:

https://developers.facebook.com/docs/meta-pixel/get-started/

<!-- Facebook Pixel Code -->
<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', '{your-pixel-id-goes-here}');
  fbq('track', 'PageView');
</script>

 

Could it just be you accidentally typed in a random character into the FB code?