Ideas? Passing Facebook Pixel Code (JS) via Total CMS

I have a single project file that serves five sub-domains. The differing content (images, links, text, etc) are kept unique via Joe Workman’s totally awesome Total CMS. I’m looking for ideas on how I can install Facebook’s Pixel coding (javascript) for each of the five sub-domains, yet maintain one project file. Note the code is unique for each sub-domain because the clients they serve all have their own Facebook pages. I know that pasting the code directly into the “Settings” / “Code” / “Head” section of Rapidweaver works…so I understand the process of properly installing the Facebook code. However, this route would force me to maintain five project files…keeping up with minor updates/changes.


  1. I’ve tried setting up a “text” field with Total CMS where I paste the Facebook javascript code in and have the “text” field macro placed into the “Head” area of the “Code” settings for Rapidweaver (see pics). This however does not work, it oddly splits the code and places some of it under the header tag and other bits under the body tag. Thus eliminating any functionality. Is the JS not going to get along with Total CMS?
  2. Could I perhaps somehow hide/show code based on a URL? So that I would have five sets of Facebook JS code and only the bit relevant to a particular sub-domain would show up?
  3. Any way I can add/insert html under the head tag using a stack? I could then easily make that code active or inactive in several different ways.

I feel like there’s a way just can’t figure it out :slight_smile: Any help or thoughts appreciated. @zeebe @joeworkman your brilliant input is welcome :slight_smile:

you can’t put a noscript like that into the header – it will not work. i suspect that code is meant to go into he body of the page.

a no-script tag can go into a header – so long as it does not contain body elements. but this one does. it contains an img tag.

to make this work you’ll probably have to put that code into the body somewhere – or remove the no-script bit.

as for how this impacts Total CMS – i’ll leave that to the experts (not me) :stuck_out_tongue_closed_eyes:

Isaiah, thank you for the input. Oddly however, the code works just fine under the head tag when I place the code into the settings/code/head setting of Rapidweaver. The site functions fine and the JS registers with Facebook and all works? Facebook instructions are to place it under the head tag. Why this works and contradicts your point is above my pay grade :slight_smile:

Have you made sure that your CMS admin text stack is set to use plain text/strip html? I don’t know why it would split things up. Having said that, I’ve used text macros in page descriptions and URL fields, but never in the code boxes for RW…

Thanks for the suggestion Jason. I’ve tried the various options for the CMS text stack settings. I have it set to text, and have tried with/without strip html, with/without markdown, etc. with no luck. Appreciate the suggestion though.


1 Like

BAM! That did the trick :slight_smile: Thanks Joe. I’m continually amazed at the things I can do with Total CMS and Foundation for that matter. Thanks for the support and an awesome product.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.