segmentio / utm-params

parse and get all utm parameters
MIT License
41 stars 7 forks source link

Querystring parsing #1

Closed amillet89 closed 9 years ago

amillet89 commented 9 years ago

@yields @calvinfo @wcjohnson11

looks like certain querystrings aren't being parsed properly. for e.g:

utm('https://translate.googleusercontent.com/translate_c?depth=1&hl=fr&prev=/search%3Fq%3Dbug%2Btracker%2Bnet%26rlz%3D1C1OPRB_enFR589FR589%26espv%3D2%26biw%3D860%26bih%3D485&rurl=translate.google.fr&sl=en&u=https://www.atlassian.com/software/jira%3Futm_source%3Difdefined%26utm_medium%3Dbanner%26utm_content%3Djira-1012%26utm_campaign%3Ddirect-display&usg=ALkJrhjj_csPeJaQjwsWavy8V6-HVnhgHQ')
{}
utm('https://www.atlassian.com/software/jira/service-desk?utm_campaign=yuX3vawa&utm_medium=navbar&utm_source=inproduct')
{ 's://www.atlassian.com/software/jira/service-desk?utm_campaign': 'yuX3vawa',
  utm_medium: 'navbar',
  utm_source: 'inproduct' }
utm('http://segment.com/redshift/?utm_source=modeanalytics.com&utm_medium=partner-website&utm_campaign=partner-docs&utm_content=redshift-docs')
{ '://segment.com/redshift/?utm_source': 'modeanalytics.com',
  medium: 'partner-website',
  name: 'partner-docs',
  content: 'redshift-docs' }

Will has more examples of working url's here, and NON-working url's here

tj commented 9 years ago

Interesting! Sounds related to the weird stuff I've been seeing in Redshift for touchofmodern https://github.com/segmentio/hq/wiki/Redshift#touchofmodern

wcjohnson11 commented 9 years ago

The previous examples were from the logs for Atlassian's main site, I'm adding some more examples I pulled up for a seperate ticket that came in this morning for Hipchat, working url's here, and NON-working url's here

^updated because links fixed and Amir invited to Mode

yields commented 9 years ago

i couldn't access modeanalytics, it's not in meldium, can you guys send me the creds?

hmm utm accepts a querystring, not a url, so it's: utm('?utm_source=modeanalytics.com&utm_medium=partner-website&utm_campaign=partner-docs&utm_content=redshift-docs').

i clicked the last two examples and looks like they are working correctly? (enabled debugging and look for segmentio sent > o)

the first one is really interesting:

There's no utm_ in the querystring at all, there's utm_ in the encoded url hidden in u=, what's the correct thing to do here?, should we check to see if the domain is translate.google.com and get u= and parse it? that's not correct IMHO.

cc @calvinfo @ianstormtaylor