예제 #1
0
def report_view(client_id, path, language, headers):
    host_name = headers.get('HTTP_HOST', None)
    referrer = headers.get('HTTP_REFERER', None)
    pv = ga.PageView(path, host_name=host_name, referrer=referrer)
    extra_info = ga.SystemInfo(language=language)
    extra_headers = {}
    """
    if '/products/' in path and '/category/' not in path and '.jpg' not in path and '.png' not in path:
        print('here')

        extra_info = [{'ecommerce': {
                       'detail': {
                         'actionField': {'list': 'Apparel Gallery'},
                         'products': [{
                           'name': 'Triblend Android T-Shirt',
                           'id': '12345',
                           'price': '15.25',
                           'brand': 'Google',
                           'category': 'Apparel',
                           'variant': 'Gray'
                          }]
                        }}}]
    """

    user_agent = headers.get('HTTP_USER_AGENT', None)
    if user_agent:
        extra_headers['user-agent'] = user_agent
    _report(client_id, pv, extra_info=extra_info, extra_headers=extra_headers)
    """
예제 #2
0
def report_view(client_id, path, language, headers):
    host_name = headers.get('HTTP_HOST', None)
    referrer = headers.get('HTTP_REFERER', None)
    pv = ga.PageView(path, host_name=host_name, referrer=referrer)
    extra_info = ga.SystemInfo(language=language)
    extra_headers = {}
    user_agent = headers.get('HTTP_USER_AGENT', None)
    if user_agent:
        extra_headers['user-agent'] = user_agent
    _report(client_id, pv, extra_info=extra_info, extra_headers=extra_headers)
예제 #3
0
파일: search_api.py 프로젝트: vied12/aleph
def exit_redirect():
    rawurl = request.args.get('u', 'https://search.openoil.net')
    newurl = urllib.parse.unquote(rawurl)
    # XXX tracking happens here, right?
    user_id = request.cookies.get('oo_search_user', 'unknown user')
    ua = app.config.get('GOOGLE_ANALYTICS_UA')
    view = google_measurement_protocol.PageView(path=request.url,
                                                referrer=request.referrer)
    google_measurement_protocol.report(ua, user_id, view)
    return redirect(newurl)
예제 #4
0
 def gmp_report_pageview(self, client_id, path=None, title=None):
     """Send GMP Pageview."""
     tid = self.settings["TID"]
     gmp.report(tid, client_id, gmp.PageView(path=path, title=title))