Drupal: How to use the Context Module to include javascript on specific pages

I needed a solution which allowed me to include Optimizely’s A/B testing snippet on certain pages, and have the ability to change those page rules without modifying code.

I do this using the Context module, I apply a class to the body for a node with the path “demo”, like so:

Then, in html.tpl.php, in the <head> of my document, I have the following code: