advertools.url_builders module — advertools 0.1a1 documentation

# advertools.url_builders module

`advertools.url_builders.` `url_utm_ga`(url, utm_source, utm_medium=None, utm_campaign=None, utm_content=None, utm_term=None)

  Generate a utm-encoded URL for your campaigns.

  URLs are are not validated. All parameters are URL-encoded.

  url : a valid URL, required utm_source : the referrer of the traffic (e.g. facebook, twitter), required utm_medium : marketing medium (e.g. banner, email) utm_campaign : the name of the campaign (e.g. summer_promo, 20pct_off) utm_content : ad name / differentiator (e.g. 728x90, mpu, square_banner) utm_term : search terms bid on (only relevant for search campaigns)

      >>> url_utm_ga('mysite.com', utm_source='the source)
      ... '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')
      ... 'mysite.com?utm_content=728x90&utm_campaign=campaign%2Aname%26%5E%25&utm_medium=THE+MEDIUM%21%21&utm_source=the+source'