How to flag if a 'webform' exists on a page?
This appears to be a preprocess function. If it's hook_preprocess_page(), you can do this:

function hook_preprocess_page(&amp;$variables)
{
  if(isset($variables['node']) &amp;&amp; $variables['node']-&gt;type == 'webform')
  {
    $variables['s.event4'] = "event4";
  }
}