@singingwolfboy, this loop takes a list of all created flags and adds only those which are active for the user to a string. This string is then sent to Mixpanel.

I like @cpennington's suggestion to use Python to build the string then use that string in the JS. I think it'd be better to leave the Control Group marked as such, instead of with the empty string. The empty string could make the data harder to understand in Mixpanel, whereas Control Group is clear.