Merge pull request #518 from pateljannat/telemetry-changes
fix: telemetry capture on client side
This commit is contained in:
@@ -235,6 +235,7 @@ jinja = {
|
|||||||
"lms.lms.utils.get_filtered_membership",
|
"lms.lms.utils.get_filtered_membership",
|
||||||
"lms.lms.utils.show_start_learing_cta",
|
"lms.lms.utils.show_start_learing_cta",
|
||||||
"lms.lms.utils.can_create_courses",
|
"lms.lms.utils.can_create_courses",
|
||||||
|
"lms.lms.utils.get_telemetry_boot_info",
|
||||||
],
|
],
|
||||||
"filters": [],
|
"filters": [],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -698,3 +698,19 @@ def get_course_completion_data():
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def get_telemetry_boot_info():
|
||||||
|
POSTHOG_PROJECT_FIELD = "posthog_project_id"
|
||||||
|
POSTHOG_HOST_FIELD = "posthog_host"
|
||||||
|
|
||||||
|
if not frappe.conf.get(POSTHOG_HOST_FIELD) or not frappe.conf.get(
|
||||||
|
POSTHOG_PROJECT_FIELD
|
||||||
|
):
|
||||||
|
return {}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"posthog_host": frappe.conf.get(POSTHOG_HOST_FIELD),
|
||||||
|
"posthog_project_id": frappe.conf.get(POSTHOG_PROJECT_FIELD),
|
||||||
|
"enable_telemetry": 1,
|
||||||
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ textarea.field-input {
|
|||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.outline-lesson .level {
|
.outline-lesson .level, .chapter-container .level {
|
||||||
justify-content: start;
|
justify-content: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import "./profile.js";
|
import "./profile.js";
|
||||||
import "./common_functions.js";
|
import "./common_functions.js";
|
||||||
import "../../../../frappe/frappe/public/js/frappe/ui/chart.js";
|
import "../../../../frappe/frappe/public/js/frappe/ui/chart.js";
|
||||||
import "../../../../frappe/frappe/public/js/telemetry/index.js";
|
|
||||||
|
|||||||
@@ -7,3 +7,16 @@
|
|||||||
Hello, world!
|
Hello, world!
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{%- block script -%}
|
||||||
|
{{ super() }}
|
||||||
|
{% if frappe.get_system_settings("enable_telemetry") %}
|
||||||
|
{% set telemetry_boot_info = get_telemetry_boot_info() %}
|
||||||
|
<script>
|
||||||
|
const telemetry_boot_info = {{ get_telemetry_boot_info() }}
|
||||||
|
if (telemetry_boot_info && Object.keys(telemetry_boot_info).length)
|
||||||
|
Object.assign(frappe.boot, telemetry_boot_info)
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
{{ include_script("telemetry.bundle.js") }}
|
||||||
|
{%- endblock -%}
|
||||||
Reference in New Issue
Block a user