Add content type machine name to an attribute in the body tag?
template_preprocess_html should be the right function to start with.

So your code should look like the following:

function mytheme_preprocess_html(&amp;$variables) {
  if ($node = menu_get_object()) {
    $variables['attributes_array']['data-init'][] = drupal_html_class('node-type-' . $node-&gt;type);
  }
}


Make sure to replace mytheme with your custom theme and clear Drupal cache.