Adding primary ids for each tagged trial