How do you add tags to tag field when saving an entry?
Like other relational fields, Tags fields’ values need to be set to an array of the tags’ IDs.

It’s not possible to create tags during entry creation; you would just need to create it first using TagsService::saveTag().

$tag = new TagModel();
$tag-&gt;groupId = 1;
$tag-&gt;getContent()-&gt;title = 'My Tag';

$success = craft()-&gt;tags-&gt;saveTag($tag);

if ($success)
{
    $tagData = array($tag-&gt;id);
}
else
{
    $tagData = null;
}

// ...

$entry-&gt;setContentFromPost(array(
    // ...
    'myTagsField' =&gt; $tagData,
));

// ...


(Note that I’m setting the field value using setContentFromPost() instead of directly on the ContentModel. This is the recommended way to set your custom field values, although for relational fields it doesn’t really matter either way.)