0

The example code given by FB for ViewContent pixel code does not work when copied and pasted using their parameters into my product page.

If I put ANY parameters in the ViewContent function pixel call other than track & viewContent, ALL parameters are ignored and the pixel does not fire; the only way I can get the pixel to fire is provide NONE OF MY PARAMETERS at all, then FB complains that certain parameters are missing.

The liquid code variables are properly initialized from prior code; ie, liquid code is populating OK into .js parameters for source code for web page.

I have tried ALL combinations of double quotes, single quotes, etc. around both keywords & data. The FB Pixel Helper extension installed to Chrome shows, when viewing web page source code, only:

fbq('track', 'ViewContent');

(even though I have provided parameters as shown below) thereby ignoring and leaving my parameters shown below out. If I do not code these parameters, and code only the line above, then the ViewContent event fires, but of course FB complains about lack of content_type and content_ids, etc.

My code:

<!-- DPWCo-eCOMMERCE Mod JSON Tags for FB Catalog generation per Product from FB Pixel --> 

<script>

   fbq('track', 'ViewContent', {
                                content_type: 'product_group',
                                content_ids: [{{my_product_variant_ids_string}}],
                                content_name: '{{product.name}}',
                                content_category: '{{my_productcollections_ids_string}}',
                                description: "{{product.description | auto_link | paragraphs}}",
                                url: "{{product.full_url}}",
                                image: "{{product.photo.url_400}}",
                                brand: '{{store.name}}',
                                value: {{product.price}},
                                currency: 'USD',
                                itemCondition: 'new',
                                availability: 'in stock'
                               });

</script>

<!-- end of DPWCo-eCOMMERCE Mod JSON Tags for FB Catalog generation from FB Pixel -->
Anna
  • 2,988
  • 3
  • 15
  • 29
K0DPW
  • 1
  • 1
  • So you _have_ replaced all your “liquid” stuff with static values, to explicitly verify it doesn’t work then either? What does the FB Pixel Helper browser extension have to say? – CBroe Mar 12 '20 at 07:56
  • Yes, even used FB static values from their examples (copy&paste), & web page source code shows their values just like mine, but pixel does not fire and ALL parameters are eliminated, resulting in: fbq('track', 'ViewContent');: – K0DPW Mar 13 '20 at 21:55
  • From FB Pixel Helper: ViewContent WARNINGS We detected event code but the pixel has not activated for this event, so no information was sent to Facebook. This could be due to an error in the code, but could also occur if the pixel fires on a dynamic event such as a button click.Learn more EVENT INFO Setup Method: Manual Pixel Code: Hide fbq('track', 'ViewContent'); Pixel Location: Show Frame: Window – K0DPW Mar 13 '20 at 21:57
  • Pixel is set to fire on individual product page load, not on button click – K0DPW Mar 16 '20 at 21:59
  • install FB Pixel Helper in Chrome, browse www.dpwco-ecommerce.com , click any product, look at page source code to confirm pixel parameters were properly loaded by liquid code processed previously, check FB Pixel Helper, see all parameters except 'track' & 'ViewContent' have been truncated and ignored. – K0DPW Mar 16 '20 at 22:04
  • Can’t; I only get a 403 Forbidden when trying to access that address. – CBroe Mar 17 '20 at 07:20
  • Also, running my code through Google's Structured Data Testing Tool ( https://search.google.com/structured-data/testing-tool/ ), as a total URL check as well as just the javascript code snippet posted above detects NO errors. – K0DPW Mar 17 '20 at 21:55
  • try: https://dpwcoecommerce.storenvy.com/ – K0DPW Mar 17 '20 at 21:58
  • Check the browser console … you got syntax errors in your pixel code. The `description` value you provide for `ViewContent` goes over multiple lines, but not in a _proper_ way for a JavaScript text literal. https://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript – CBroe Mar 18 '20 at 07:20
  • thanks - i'll work on it – K0DPW Mar 18 '20 at 22:32

0 Answers0