Not much of a coder and I am trying to generate a UTM link (Google Analytics) in my calculation field by combining fields...and I would like to not display segments of the code when a field is blank.
Here's the code for my calculation field...
@Link + "?utm_campaign=" + @Campaign.replace(/ /g, '') + "&utm_source=" + @Source.replace(/ /g, '') + "&utm_medium=" + @Medium.replace(/ /g, '') + "&utm_content=" + @Content.replace(/ /g, '') + "&utm_term=" + @Term
What I mean by segment is each @field value is coupled with "&utm_fieldname" to render "&utm_fieldname=fieldvalue"
Please sign in to leave a comment.