How to get a Facebook Pixel to work with GoDaddy Website Builder

I don’t generally use GoDaddy Website builder. As a web developer, I opt for more powerful and customizable tools like WordPress, however, today I had to install a Facebook Pixel for an advertising client that built their own website on GoDaddy Website Builder.

At first, this seemed like an easy task. I was able to navigate to site settings and use the “Site-wide Code” function to paste the Pixel javascript into the header. I saved and published and the pixel showed up in the source! Unfortunately, it didn’t actually function. I used Facebook’s pixel Chrome extension to test and while it was recognized it was not sending a PageView.

Instead, I got an error:
PageView
The Facebook pixel code on this page didn’t load, so no information was sent to Facebook. Learn more

This error was not terribly helpful and nor was the documentation. It suggested there may be some sort of a problem with a button event, well, I didn’t setup a button event. I spent more time than I should’ve trying to debug and I discovered if I did add events things start work… sort of.

Eventually, after much testing I discovered the problem. GoDaddy Website Builder minifies the HTML and javascript. This is great except when it does it the minification tool doesn’t remove Javascript comments within<
tags. The Facebook Pixel code comes configured like this:

Notice the link:

There is a comment

The GoDaddy minification system minified the code and turned it into a single line of Javascript. This resulted in the next line of code

Being commented out

Removing this internal comment from the Facebook pixel code solved the problem and everything worked as expected.

 

You may also like...

2 Responses

  1. Cody says:

    What exactly did you take out of the code? I keep trying and it slows down my website immensely and still doesn’t track correctly

  2. Kelsey says:

    Was in this same exact position and couldn’t figure out what went wrong. Thanks so much for the insight and troubleshooting help!

Leave a Reply

Your email address will not be published. Required fields are marked *