Exemple #1
0
def test_track(ready):
    url = 'http://local.test/' + faker.uri_path()

    track(url)

    data = analyze('Actions.getPageUrls', period='day', date=date.today(), expanded=1)
    t = find_tracking(url, data)
    assert t is not None, 'No tracking entry found for {}'.format(url)
Exemple #2
0
def piwik_track_api(url, **params):
    '''Track an API request into Piwik.'''
    log.debug('Sending to piwik: {url}'.format(url=url))
    if 'user_ip' in params:
        params['cip'] = params.pop('user_ip')
    if current_app.config.get('PIWIK_BULK', PIWIK_BULK_DEFAULT):
        PiwikTracking.objects.create(url=url, kwargs=params)
    else:
        track(url, is_api=True, **params)
Exemple #3
0
def test_track(ready):
    '''
    Use bulk_track w/ default params which should log to PIWIK_ID_FRONT
    '''
    url = 'http://local.test/' + faker.uri_path()

    track(url)

    data = analyze('Actions.getPageUrls',
                   period='day',
                   date=date.today(),
                   expanded=1)
    t = find_tracking(url, data)
    assert t is not None, 'No tracking entry found for {}'.format(url)
Exemple #4
0
def download(obj, context_url=None, latest=False):
    context_url = context_url or obj.url
    url = obj.latest if latest else obj.url
    return track(context_url, download=url)
Exemple #5
0
def visit(obj):
    return track(obj.external_url)
Exemple #6
0
def piwik_track_new_follow(url, **params):
    '''Track a new follow into Piwik.'''
    log.debug('Sending to piwik: {url}'.format(url=url))
    track(url, **params)
Exemple #7
0
def piwik_track_reuse_published(url, **params):
    '''Track a reuse publication into Piwik.'''
    log.debug('Sending to piwik: {url}'.format(url=url))
    track(url, **params)
Exemple #8
0
def download(obj, context_url=None, latest=False):
    context_url = context_url or obj.url
    url = obj.latest if latest else obj.url
    return track(context_url, download=url)
Exemple #9
0
def visit(obj):
    return track(obj.external_url)