How to add twitter tracking code to a Drupal site? Twitter now creates code to track visits to your site from twitter.  https://support.twitter.com/articles/20170807-conversion-tracking-for-websites#

Where would be the best place to put this code, into a template? is there a module for this like there is for google analytics?
The proper way is to use hook_page_alter() in your template.php or a custom module. But there's also a module out there to accomplish this task:

Take a look at the module Tracking Code. It allows you to inject arbitrary code inside &lt;HEAD&gt;, after &lt;BODY&gt; or before &lt;/BODY&gt;.