URL Builders

url_utm_ga(url, utm_source, utm_medium=None, utm_campaign=None, utm_content=None, utm_term=None)[source]

Generate a URL with UTM codes for your campaigns.

  • url (str) -- a valid URL, required

  • utm_source (str) -- the referrer of the traffic (e.g. facebook, twitter)

  • utm_medium (str) -- marketing medium (e.g. banner, email)

  • utm_campaign (str) -- the name of the campaign (e.g. summer_promo, 20pct_off)

  • utm_content (str) -- ad name / differentiator (e.g. 728x90, mpu, square_banner)

  • utm_term (str) -- search terms bid on (only relevant for search campaigns)


URL-encoded string for the campaign

>>> url_utm_ga('mysite.com', utm_source='the source')
>>> url_utm_ga('mysite.com', utm_source='the source',
...            utm_medium='THE MEDIUM!!',
...            utm_campaign='campaign*name&^%',utm_content='728x90')