Package: django-femtolytics
django-femtolyticsThis is the open-source code used forfemtolytics.com. With this django package you can run your own instance of femtolytics and not depend on any third-party tracking for understanding how people use your mobile application.You can find a Flutter client for femtolytics athttps://pub.dev/packages/femtolyticsYou can find a Django sample project that is configured properly to run django-femtolytics atdjango-femtolytics-sample. If you already have an existing Django project and want to incorporate django-femtolytics into it, follow the instructions below.Getting StartedFirst you will need to install the dependencypip install django-femtolyticsOr add it to your requirements.txtdjango-femtolyticsSetting upIn your project's settings.py add femtolytics to the list of applicationsINSTALLED_APPS=[...'femtolytics',]Then, you can add the path to your project URLs:fromdjango.confimportsettingsfromdjango.contribimportadminfromdjango.urlsimportpath,includeurlpatterns=[path('analytics/api/v1/',include('femtolytics.api.urls')),path('analytics/',include('femtolytics.urls')),]Thefemtolytics.api.urlscorresponds to the endpoint that the mobile application client will send information to. You should make sure it matches the URL you pass when configuring the client in your application.Thefemtolytics.urlsare the main dashboard URLs which will give you access to insights on what your users are doing. You will be able to track, sessions, visitors, custom actions, goals and crashes.Finally make sure to install the migrationspython manage.py migrateAll of the dashboard URLSfemtolytics.urlswill require a user to be logged in, so you can make sure nobody has access to that information.TrackingFemtolytics requires to have created an application with the same package name you used in your application. So make sure to visit the dashboard andadd an applicationbefore generating event in your client.CustomizingThe dashboard is customizable as it usesTemplate ViewsandForm Views.Here are the different views that are usedDashboardViewis a springboard view which will select the first registered mobile application and redirect to the dashboard of that view.DashboardByAppViewto generate the dashboard for a particular application.AppsViewshows the list of configured applications.AppsAddis a FormView to add register a new application.AppsEditis the same FormView but to edit an existing application.AppsDeleteto delete an application.SessionsViewis a springboard view which will select the first registered mobile application and redirect to the list of sessions for that application.SessionsByAppViewshows the list of sessions for a particular application.SessionViewshows a particular session.VisitorsViewis a sprinboard view which will select the first registered mobile application and redirect to the list of visitors for that application.VisitorsByAppViewshows the list of visitors for a particular application.VisitorViewshows a particular visitor.CrashesViewis a sprinboard view which will select the first registered mobile application and redirect to the list of crashes for that application.CrashesByAppViewshows a list of crashes for a particular application.CrashViewshows a particular crash.GoalsViewis a sprinboard view which will select the first registered mobile application and redirect to the list of goals for that application.GoalsByAppViewshows a list of goals for a particular application.GoalViewshows a particular goal.The springboard viewsDashboardView,SessionsView,VisitorsView,CrashesViewandGoalsViewtake asuccess_urlandfailed_urlfor the redirects. If an application is found it redirects tosuccess_urlotherwise redirects tofailed_url.OnlyAppsAdd,AppsEditandAppsDeletetake asuccess_urlparameter to define where to redirect after adding, editing or deleting an application.Here is a sample custom routing definition to use your custom templates:app_name="analytics"urlpatterns=[path("",views.index,name="index"),# Dashboardpath("dashboard",subscription_required()(femto_views.DashboardView.as_view(success_url="analytics:dashboards_by_app",failed_url="analytics:apps_add",)),name="dashboard",),path("dashboard/<uuid:app_id>",subscription_required()(femto_views.DashboardByAppView.as_view(template_name="analytics/dashboard.html",)),name="dashboards_by_app",),# Appspath("apps/",femto_views.AppsView.as_view(template_name="analytics/apps.html",),name="apps",),path("apps/add",femto_views.AppsAdd.as_view(template_name="analytics/apps_add.html",success_url=reverse_lazy("analytics:apps"),),name="apps_add",),path("apps/edit/<uuid:app_id>",femto_views.AppsEdit.as_view(template_name="analytics/apps_add.html",success_url=reverse_lazy("analytics:apps"),),name="apps_edit",),path("apps/delete/<uuid:app_id>",femto_views.AppsDelete.as_view(success_url=reverse_lazy("analytics:apps"),),name="apps_delete",),# Sessionspath("sessions",subscription_required()(femto_views.SessionsView.as_view(success_url="analytics:sessions_by_app",failed_url="analytics:account",),),name="sessions",),path("sessions/<uuid:app_id>",subscription_required()(femto_views.SessionsByAppView.as_view(template_name="analytics/sessions.html",)),name="sessions_by_app",),path("sessions/<uuid:app_id>/<uuid:session_id>",subscription_required()(femto_views.SessionView.as_view(template_name="analytics/session.html",)),name="session",),# Visitorspath("visitors",subscription_required()(femto_views.VisitorsView.as_view(success_url="analytics:visitors_by_app",failed_url="analytics:account",)),name="visitors",),path("visitors/<uuid:app_id>",subscription_required()(femto_views.VisitorsByAppView.as_view(template_name="analytics/visitors.html",)),name="visitors_by_app",),path("visitors/<uuid:app_id>/<uuid:visitor_id>",subscription_required()(femto_views.VisitorView.as_view(template_name="analytics/visitor.html",)),name="visitor",),# Crashpath("crashes/<uuid:app_id>/<uuid:crash_id>",subscription_required()(femto_views.CrashView.as_view(template_name="analytics/crash.html",)),name="crash",),# Goalpath("goals/<uuid:app_id>/<uuid:goal_id>",subscription_required()(femto_views.GoalView.as_view(template_name="analytics/goal.html",)),name="goal",),]