Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send uip using systeminfo #15

Open
primal100 opened this issue Jan 26, 2018 · 0 comments
Open

Send uip using systeminfo #15

primal100 opened this issue Jan 26, 2018 · 0 comments

Comments

@primal100
Copy link

primal100 commented Jan 26, 2018

Hey,

In Saleor I want to send uip as an additional attribute. This is used to provide provide location data to Google Measurement Protocol. I managed to do this without any changes to google measurement protocol but it's probably not the "correct" way, as it involves sending a dictionary instead of a SystemInfo instance.

Saleor version:

My version

def report_view(client_id, ip, 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) #old line
    extra_info = [{'ul': language, 'uip': ip}] #new line
    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)

I was thinking of making a pull request to Saleor to allow sending the uip (possibly configurable by a setting). But I think the way I'm doing, using a dictionary is not the correct way. But the SystemInfo class confuses me. Is it possible to modify it to add additional, optional attributes such as uip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant