Exemplo n.º 1
0
def clean_url(url):
    if url and 'linkedin.com' in url:
        return strip_params(url, ['refId', 'trk'])
    if url and 'talentify.io' in url:
        return strip_params(url, ['tdd'])
    if url and 'neuvoo.cz' in url:
        return strip_params(url, ['puid'])
    if url and 'lever.co' in url:
        return re.sub(r'/apply$', '/', url)
    return url
Exemplo n.º 2
0
def clean_url(url):
    if url and 'linkedin.com' in url:
        return strip_params(url, ['refId', 'trk'])
    if url and 'talentify.io' in url:
        return strip_params(url, ['tdd'])
    if url and 'neuvoo.cz' in url:
        return strip_params(url, ['puid'])
    if url and 'lever.co' in url:
        return re.sub(r'/apply$', '/', url)
    url = strip_params(url, UTM_PARAM_NAMES)
    url = replace_in_params(url, 'linkedin', 'juniorguru', case_insensitive=True)
    return url
Exemplo n.º 3
0
def per_url_report_to_dict(report):
    data = {}
    for row in report['data']['rows']:
        url = strip_params(row['dimensions'][0], 'fbclid')
        value = int(row['metrics'][0]['values'][0])
        data.setdefault(url, 0)
        data[url] += value
    return data
Exemplo n.º 4
0
def clean_proxied_url(url):
    proxied_url = get_param(url, 'url')
    if proxied_url:
        param_names = ['utm_source', 'utm_medium', 'utm_campaign']
        proxied_url = strip_params(proxied_url, param_names)
        return replace_in_params(proxied_url,
                                 'linkedin',
                                 'juniorguru',
                                 case_insensitive=True)
    return url
Exemplo n.º 5
0
def test_strip_params(url, param_names, expected):
    assert url_params.strip_params(url, param_names) == expected
Exemplo n.º 6
0
def clean_proxied_url(url):
    proxied_url = get_param(url, 'url')
    if proxied_url:
        proxied_url = strip_params(proxied_url, UTM_PARAM_NAMES)
        return replace_in_params(proxied_url, 'linkedin', 'juniorguru', case_insensitive=True)
    return url
Exemplo n.º 7
0
def clean_url(url):
    if url and 'linkedin.com' in url:
        return strip_params(url, ['refId', 'trk'])
    return url