Bonus, also done!
Before I give you the formula, let me explain what’s added:
IF functions are wrapped around each UTM tag. You’ll notice there is no =, this because any text (except ‘false’ or ‘0’) will return TRUE. So each if says, “if there is text in this field, then show the UTM tag.”
REPLACE, is used to add the ‘?’ to the beginning of the UTM tags replacing the first ‘&’. All tags now start with this because we don’t know which will be the first tag.
LOWER, this one is easy just wrap it around anything and it’ll change the case to lower.
And now for the formula:
IF(Medium,'&utm_medium=' & Medium) &
IF(Source,'&utm_source=' & Source) &
IF(Campaign,'&utm_campaign=' & Campaign) &
IF(Content,'&utm_content=' & Content) &
IF(Keyword,'&utm_keyword=' & Keyword)
, ' ', '%20')
Best of luck! If you need to add new UTM tags. I suggest copying the formula into notepad and adding mimicking the IF formula replacing it with your new tags name.