We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
json serialization error with google analytics enabled
### What I'm trying to achieve
I want to enable google analytics of a docker image I build using the current docker files from the master repo. I am starting it in beanstalk and then the error occurs:  
```
/var/log/eb-docker/containers/eb-current-app/eb-d5c249ad18da-stdouterr.log
-------------------------------------
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type generator is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./saleor/core/middleware.py", line 27, in middleware
    client_id, path=path, language=language, headers=headers)
  File "./saleor/core/analytics.py", line 68, in report_view
    _report(client_id, payloads, extra_headers=extra_headers)
  File "./saleor/core/analytics.py", line 36, in _report
    **extra_data)
  File "/usr/local/lib/python3.7/site-packages/celery/app/task.py", line 427, in delay
    return self.apply_async(args, kwargs)
  File "/usr/local/lib/python3.7/site-packages/celery/app/task.py", line 544, in apply_async
    body, serializer,
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 221, in dumps
    payload = encoder(data)
  File "/usr/local/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 54, in _reraise_errors
    reraise(wrapper, wrapper(exc), sys.exc_info()[2])
  File "/usr/local/lib/python3.7/site-packages/vine/five.py", line 194, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 50, in _reraise_errors
    yield
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 221, in dumps
    payload = encoder(data)
  File "/usr/local/lib/python3.7/site-packages/kombu/utils/json.py", line 69, in dumps
    **dict(default_kwargs, **kwargs))
  File "/usr/local/lib/python3.7/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/local/lib/python3.7/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.7/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python3.7/site-packages/kombu/utils/json.py", line 59, in default
    return super(JSONEncoder, self).default(o)
  File "/usr/local/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
kombu.exceptions.EncodeError: Object of type generator is not JSON serializable
ERROR saleor.core.middleware Unable to update analytics [PID:17:uWSGIWorker2Core0]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 50, in _reraise_errors
    yield
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 221, in dumps
    payload = encoder(data)
  File "/usr/local/lib/python3.7/site-packages/kombu/utils/json.py", line 69, in dumps
    **dict(default_kwargs, **kwargs))
  File "/usr/local/lib/python3.7/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/local/lib/python3.7/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.7/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python3.7/site-packages/kombu/utils/json.py", line 59, in default
    return super(JSONEncoder, self).default(o)
  File "/usr/local/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type generator is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./saleor/core/middleware.py", line 27, in middleware
    client_id, path=path, language=language, headers=headers)
  File "./saleor/core/analytics.py", line 68, in report_view
    _report(client_id, payloads, extra_headers=extra_headers)
  File "./saleor/core/analytics.py", line 36, in _report
    **extra_data)
  File "/usr/local/lib/python3.7/site-packages/celery/app/task.py", line 427, in delay
    return self.apply_async(args, kwargs)
  File "/usr/local/lib/python3.7/site-packages/celery/app/task.py", line 544, in apply_async
    body, serializer,
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 221, in dumps
    payload = encoder(data)
  File "/usr/local/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 54, in _reraise_errors
    reraise(wrapper, wrapper(exc), sys.exc_info()[2])
  File "/usr/local/lib/python3.7/site-packages/vine/five.py", line 194, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 50, in _reraise_errors
    yield
  File "/usr/local/lib/python3.7/site-packages/kombu/serialization.py", line 221, in dumps
    payload = encoder(data)
  File "/usr/local/lib/python3.7/site-packages/kombu/utils/json.py", line 69, in dumps
    **dict(default_kwargs, **kwargs))
  File "/usr/local/lib/python3.7/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/local/lib/python3.7/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.7/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python3.7/site-packages/kombu/utils/json.py", line 59, in default
    return super(JSONEncoder, self).default(o)
  File "/usr/local/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
kombu.exceptions.EncodeError: Object of type generator is not JSON serializable
UWSGI uwsgi "GET /de/cart/summary/ HTTP/1.1" 200 785 29ms [PID:17:Worker-2] [RSS:162MB]```

### Steps to reproduce the problem
1. Build the docker image  
2. Try to start it in beanstalk with the minimal needed env variables set and google analytics id set too  
3. Look into the logs and find the error in question

### What I expected to happen
Beanstalk starts the dockerimage with the needed minimal env variables and google analytics enabled.  
  
There is a merge request related to this #3615  

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `saleor/core/analytics.py`
Content:
```
1 import uuid
2 
3 import google_measurement_protocol as ga
4 from django.conf import settings
5 
6 from ..celeryconf import app
7 
8 FINGERPRINT_PARTS = [
9     "HTTP_ACCEPT_ENCODING",
10     "HTTP_ACCEPT_LANGUAGE",
11     "HTTP_USER_AGENT",
12     "HTTP_X_FORWARDED_FOR",
13     "REMOTE_ADDR",
14 ]
15 
16 UUID_NAMESPACE = uuid.UUID("fb4abc05-e2fb-4e3e-8b78-28037ef7d07f")
17 
18 
19 def get_client_id(request):
20     parts = [request.META.get(key, "") for key in FINGERPRINT_PARTS]
21     name = "_".join(parts)
22     return uuid.uuid5(UUID_NAMESPACE, name)
23 
24 
25 @app.task
26 def ga_report(tracking_id, client_id, payloads, extra_headers=None, **extra_data):
27     ga.report(
28         tracking_id, client_id, payloads, extra_headers=extra_headers, **extra_data
29     )
30 
31 
32 def _report(client_id, payloads, extra_headers=None, **extra_data):
33     tracking_id = getattr(settings, "GOOGLE_ANALYTICS_TRACKING_ID", None)
34     if tracking_id and client_id:
35         ga_report.delay(
36             tracking_id, client_id, payloads, extra_headers=extra_headers, **extra_data
37         )
38 
39 
40 def get_order_payloads(order):
41     items = [
42         ga.item(
43             str(order_line),
44             order_line.unit_price.gross,
45             quantity=order_line.quantity,
46             item_id=order_line.product_sku,
47         )
48         for order_line in order
49     ]
50     return ga.transaction(
51         order.id,
52         items,
53         revenue=order.total.gross,
54         tax=order.total.tax,
55         shipping=order.shipping_price.net,
56     )
57 
58 
59 def report_order(client_id, order):
60     payloads = get_order_payloads(order)
61     _report(client_id, payloads)
62 
63 
64 def get_view_payloads(path, language, headers):
65     host_name = headers.get("HTTP_HOST", None)
66     referrer = headers.get("HTTP_REFERER", None)
67     return ga.pageview(path, host_name=host_name, referrer=referrer, language=language)
68 
69 
70 def report_view(client_id, path, language, headers):
71     payloads = get_view_payloads(path, language, headers)
72     extra_headers = {}
73     user_agent = headers.get("HTTP_USER_AGENT", None)
74     if user_agent:
75         extra_headers["user-agent"] = user_agent
76     _report(client_id, payloads, extra_headers=extra_headers)
77
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/saleor/core/analytics.py b/saleor/core/analytics.py
--- a/saleor/core/analytics.py
+++ b/saleor/core/analytics.py
@@ -1,4 +1,5 @@
 import uuid
+from typing import Generator, List
 
 import google_measurement_protocol as ga
 from django.conf import settings
@@ -23,17 +24,25 @@
 
 
 @app.task
-def ga_report(tracking_id, client_id, payloads, extra_headers=None, **extra_data):
+def ga_report(
+    tracking_id, client_id, payloads: List[dict], extra_headers=None, **extra_data
+):
     ga.report(
         tracking_id, client_id, payloads, extra_headers=extra_headers, **extra_data
     )
 
 
-def _report(client_id, payloads, extra_headers=None, **extra_data):
+def _report(
+    client_id, payloads: Generator[dict, None, None], extra_headers=None, **extra_data
+):
     tracking_id = getattr(settings, "GOOGLE_ANALYTICS_TRACKING_ID", None)
     if tracking_id and client_id:
         ga_report.delay(
-            tracking_id, client_id, payloads, extra_headers=extra_headers, **extra_data
+            tracking_id,
+            client_id,
+            list(payloads),
+            extra_headers=extra_headers,
+            **extra_data,
         )

{"golden_diff": "diff --git a/saleor/core/analytics.py b/saleor/core/analytics.py\n--- a/saleor/core/analytics.py\n+++ b/saleor/core/analytics.py\n@@ -1,4 +1,5 @@\n import uuid\n+from typing import Generator, List\n \n import google_measurement_protocol as ga\n from django.conf import settings\n@@ -23,17 +24,25 @@\n \n \n @app.task\n-def ga_report(tracking_id, client_id, payloads, extra_headers=None, **extra_data):\n+def ga_report(\n+    tracking_id, client_id, payloads: List[dict], extra_headers=None, **extra_data\n+):\n     ga.report(\n         tracking_id, client_id, payloads, extra_headers=extra_headers, **extra_data\n     )\n \n \n-def _report(client_id, payloads, extra_headers=None, **extra_data):\n+def _report(\n+    client_id, payloads: Generator[dict, None, None], extra_headers=None, **extra_data\n+):\n     tracking_id = getattr(settings, \"GOOGLE_ANALYTICS_TRACKING_ID\", None)\n     if tracking_id and client_id:\n         ga_report.delay(\n-            tracking_id, client_id, payloads, extra_headers=extra_headers, **extra_data\n+            tracking_id,\n+            client_id,\n+            list(payloads),\n+            extra_headers=extra_headers,\n+            **extra_data,\n         )\n", "issue": "json serialization error with google analytics enabled\n### What I'm trying to achieve\r\nI want to enable google analytics of a docker image I build using the current docker files from the master repo. I am starting it in beanstalk and then the error occurs:  \r\n```\r\n/var/log/eb-docker/containers/eb-current-app/eb-d5c249ad18da-stdouterr.log\r\n-------------------------------------\r\n    raise TypeError(f'Object of type {o.__class__.__name__} '\r\nTypeError: Object of type generator is not JSON serializable\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"./saleor/core/middleware.py\", line 27, in middleware\r\n    client_id, path=path, language=language, headers=headers)\r\n  File \"./saleor/core/analytics.py\", line 68, in report_view\r\n    _report(client_id, payloads, extra_headers=extra_headers)\r\n  File \"./saleor/core/analytics.py\", line 36, in _report\r\n    **extra_data)\r\n  File \"/usr/local/lib/python3.7/site-packages/celery/app/task.py\", line 427, in delay\r\n    return self.apply_async(args, kwargs)\r\n  File \"/usr/local/lib/python3.7/site-packages/celery/app/task.py\", line 544, in apply_async\r\n    body, serializer,\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 221, in dumps\r\n    payload = encoder(data)\r\n  File \"/usr/local/lib/python3.7/contextlib.py\", line 130, in __exit__\r\n    self.gen.throw(type, value, traceback)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 54, in _reraise_errors\r\n    reraise(wrapper, wrapper(exc), sys.exc_info()[2])\r\n  File \"/usr/local/lib/python3.7/site-packages/vine/five.py\", line 194, in reraise\r\n    raise value.with_traceback(tb)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 50, in _reraise_errors\r\n    yield\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 221, in dumps\r\n    payload = encoder(data)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/utils/json.py\", line 69, in dumps\r\n    **dict(default_kwargs, **kwargs))\r\n  File \"/usr/local/lib/python3.7/json/__init__.py\", line 238, in dumps\r\n    **kw).encode(obj)\r\n  File \"/usr/local/lib/python3.7/json/encoder.py\", line 199, in encode\r\n    chunks = self.iterencode(o, _one_shot=True)\r\n  File \"/usr/local/lib/python3.7/json/encoder.py\", line 257, in iterencode\r\n    return _iterencode(o, 0)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/utils/json.py\", line 59, in default\r\n    return super(JSONEncoder, self).default(o)\r\n  File \"/usr/local/lib/python3.7/json/encoder.py\", line 179, in default\r\n    raise TypeError(f'Object of type {o.__class__.__name__} '\r\nkombu.exceptions.EncodeError: Object of type generator is not JSON serializable\r\nERROR saleor.core.middleware Unable to update analytics [PID:17:uWSGIWorker2Core0]\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 50, in _reraise_errors\r\n    yield\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 221, in dumps\r\n    payload = encoder(data)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/utils/json.py\", line 69, in dumps\r\n    **dict(default_kwargs, **kwargs))\r\n  File \"/usr/local/lib/python3.7/json/__init__.py\", line 238, in dumps\r\n    **kw).encode(obj)\r\n  File \"/usr/local/lib/python3.7/json/encoder.py\", line 199, in encode\r\n    chunks = self.iterencode(o, _one_shot=True)\r\n  File \"/usr/local/lib/python3.7/json/encoder.py\", line 257, in iterencode\r\n    return _iterencode(o, 0)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/utils/json.py\", line 59, in default\r\n    return super(JSONEncoder, self).default(o)\r\n  File \"/usr/local/lib/python3.7/json/encoder.py\", line 179, in default\r\n    raise TypeError(f'Object of type {o.__class__.__name__} '\r\nTypeError: Object of type generator is not JSON serializable\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"./saleor/core/middleware.py\", line 27, in middleware\r\n    client_id, path=path, language=language, headers=headers)\r\n  File \"./saleor/core/analytics.py\", line 68, in report_view\r\n    _report(client_id, payloads, extra_headers=extra_headers)\r\n  File \"./saleor/core/analytics.py\", line 36, in _report\r\n    **extra_data)\r\n  File \"/usr/local/lib/python3.7/site-packages/celery/app/task.py\", line 427, in delay\r\n    return self.apply_async(args, kwargs)\r\n  File \"/usr/local/lib/python3.7/site-packages/celery/app/task.py\", line 544, in apply_async\r\n    body, serializer,\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 221, in dumps\r\n    payload = encoder(data)\r\n  File \"/usr/local/lib/python3.7/contextlib.py\", line 130, in __exit__\r\n    self.gen.throw(type, value, traceback)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 54, in _reraise_errors\r\n    reraise(wrapper, wrapper(exc), sys.exc_info()[2])\r\n  File \"/usr/local/lib/python3.7/site-packages/vine/five.py\", line 194, in reraise\r\n    raise value.with_traceback(tb)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 50, in _reraise_errors\r\n    yield\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/serialization.py\", line 221, in dumps\r\n    payload = encoder(data)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/utils/json.py\", line 69, in dumps\r\n    **dict(default_kwargs, **kwargs))\r\n  File \"/usr/local/lib/python3.7/json/__init__.py\", line 238, in dumps\r\n    **kw).encode(obj)\r\n  File \"/usr/local/lib/python3.7/json/encoder.py\", line 199, in encode\r\n    chunks = self.iterencode(o, _one_shot=True)\r\n  File \"/usr/local/lib/python3.7/json/encoder.py\", line 257, in iterencode\r\n    return _iterencode(o, 0)\r\n  File \"/usr/local/lib/python3.7/site-packages/kombu/utils/json.py\", line 59, in default\r\n    return super(JSONEncoder, self).default(o)\r\n  File \"/usr/local/lib/python3.7/json/encoder.py\", line 179, in default\r\n    raise TypeError(f'Object of type {o.__class__.__name__} '\r\nkombu.exceptions.EncodeError: Object of type generator is not JSON serializable\r\nUWSGI uwsgi \"GET /de/cart/summary/ HTTP/1.1\" 200 785 29ms [PID:17:Worker-2] [RSS:162MB]```\r\n\r\n### Steps to reproduce the problem\r\n1. Build the docker image  \r\n2. Try to start it in beanstalk with the minimal needed env variables set and google analytics id set too  \r\n3. Look into the logs and find the error in question\r\n\r\n### What I expected to happen\r\nBeanstalk starts the dockerimage with the needed minimal env variables and google analytics enabled.  \r\n  \r\nThere is a merge request related to this #3615  \n", "before_files": [{"content": "import uuid\n\nimport google_measurement_protocol as ga\nfrom django.conf import settings\n\nfrom ..celeryconf import app\n\nFINGERPRINT_PARTS = [\n    \"HTTP_ACCEPT_ENCODING\",\n    \"HTTP_ACCEPT_LANGUAGE\",\n    \"HTTP_USER_AGENT\",\n    \"HTTP_X_FORWARDED_FOR\",\n    \"REMOTE_ADDR\",\n]\n\nUUID_NAMESPACE = uuid.UUID(\"fb4abc05-e2fb-4e3e-8b78-28037ef7d07f\")\n\n\ndef get_client_id(request):\n    parts = [request.META.get(key, \"\") for key in FINGERPRINT_PARTS]\n    name = \"_\".join(parts)\n    return uuid.uuid5(UUID_NAMESPACE, name)\n\n\n@app.task\ndef ga_report(tracking_id, client_id, payloads, extra_headers=None, **extra_data):\n    ga.report(\n        tracking_id, client_id, payloads, extra_headers=extra_headers, **extra_data\n    )\n\n\ndef _report(client_id, payloads, extra_headers=None, **extra_data):\n    tracking_id = getattr(settings, \"GOOGLE_ANALYTICS_TRACKING_ID\", None)\n    if tracking_id and client_id:\n        ga_report.delay(\n            tracking_id, client_id, payloads, extra_headers=extra_headers, **extra_data\n        )\n\n\ndef get_order_payloads(order):\n    items = [\n        ga.item(\n            str(order_line),\n            order_line.unit_price.gross,\n            quantity=order_line.quantity,\n            item_id=order_line.product_sku,\n        )\n        for order_line in order\n    ]\n    return ga.transaction(\n        order.id,\n        items,\n        revenue=order.total.gross,\n        tax=order.total.tax,\n        shipping=order.shipping_price.net,\n    )\n\n\ndef report_order(client_id, order):\n    payloads = get_order_payloads(order)\n    _report(client_id, payloads)\n\n\ndef get_view_payloads(path, language, headers):\n    host_name = headers.get(\"HTTP_HOST\", None)\n    referrer = headers.get(\"HTTP_REFERER\", None)\n    return ga.pageview(path, host_name=host_name, referrer=referrer, language=language)\n\n\ndef report_view(client_id, path, language, headers):\n    payloads = get_view_payloads(path, language, headers)\n    extra_headers = {}\n    user_agent = headers.get(\"HTTP_USER_AGENT\", None)\n    if user_agent:\n        extra_headers[\"user-agent\"] = user_agent\n    _report(client_id, payloads, extra_headers=extra_headers)\n", "path": "saleor/core/analytics.py"}], "after_files": [{"content": "import uuid\nfrom typing import Generator, List\n\nimport google_measurement_protocol as ga\nfrom django.conf import settings\n\nfrom ..celeryconf import app\n\nFINGERPRINT_PARTS = [\n    \"HTTP_ACCEPT_ENCODING\",\n    \"HTTP_ACCEPT_LANGUAGE\",\n    \"HTTP_USER_AGENT\",\n    \"HTTP_X_FORWARDED_FOR\",\n    \"REMOTE_ADDR\",\n]\n\nUUID_NAMESPACE = uuid.UUID(\"fb4abc05-e2fb-4e3e-8b78-28037ef7d07f\")\n\n\ndef get_client_id(request):\n    parts = [request.META.get(key, \"\") for key in FINGERPRINT_PARTS]\n    name = \"_\".join(parts)\n    return uuid.uuid5(UUID_NAMESPACE, name)\n\n\n@app.task\ndef ga_report(\n    tracking_id, client_id, payloads: List[dict], extra_headers=None, **extra_data\n):\n    ga.report(\n        tracking_id, client_id, payloads, extra_headers=extra_headers, **extra_data\n    )\n\n\ndef _report(\n    client_id, payloads: Generator[dict, None, None], extra_headers=None, **extra_data\n):\n    tracking_id = getattr(settings, \"GOOGLE_ANALYTICS_TRACKING_ID\", None)\n    if tracking_id and client_id:\n        ga_report.delay(\n            tracking_id,\n            client_id,\n            list(payloads),\n            extra_headers=extra_headers,\n            **extra_data,\n        )\n\n\ndef get_order_payloads(order):\n    items = [\n        ga.item(\n            str(order_line),\n            order_line.unit_price.gross,\n            quantity=order_line.quantity,\n            item_id=order_line.product_sku,\n        )\n        for order_line in order\n    ]\n    return ga.transaction(\n        order.id,\n        items,\n        revenue=order.total.gross,\n        tax=order.total.tax,\n        shipping=order.shipping_price.net,\n    )\n\n\ndef report_order(client_id, order):\n    payloads = get_order_payloads(order)\n    _report(client_id, payloads)\n\n\ndef get_view_payloads(path, language, headers):\n    host_name = headers.get(\"HTTP_HOST\", None)\n    referrer = headers.get(\"HTTP_REFERER\", None)\n    return ga.pageview(path, host_name=host_name, referrer=referrer, language=language)\n\n\ndef report_view(client_id, path, language, headers):\n    payloads = get_view_payloads(path, language, headers)\n    extra_headers = {}\n    user_agent = headers.get(\"HTTP_USER_AGENT\", None)\n    if user_agent:\n        extra_headers[\"user-agent\"] = user_agent\n    _report(client_id, payloads, extra_headers=extra_headers)\n", "path": "saleor/core/analytics.py"}]}