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

Track API requests with Matomo #1201

Merged
merged 1 commit into from
Feb 20, 2022
Merged

Conversation

svenseeberg
Copy link
Member

@svenseeberg svenseeberg commented Feb 19, 2022

Short description

Track single page and pages API endpoint requests with Matomo.

Proposed changes

Add a decorator to allow tracking API endpoints. The decorator spawns a thread which executes the HTTP request to Matomo. This improves the performance of the CMS API, as the request does not have to wait for the response from Matomo.

Resolved issues

Fixes: #1196

This mostly works, however the cip parameter (https://developer.matomo.org/api-reference/tracking-api) breaks the request.

@svenseeberg svenseeberg requested a review from a team as a code owner February 19, 2022 14:32
@svenseeberg svenseeberg marked this pull request as draft February 19, 2022 14:33
@svenseeberg svenseeberg force-pushed the feature/matomo-tracking branch 4 times, most recently from 5b4b771 to 8a237d0 Compare February 19, 2022 16:50
@svenseeberg svenseeberg marked this pull request as ready for review February 19, 2022 17:15
Copy link
Member

@timobrembeck timobrembeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! 🎉
The async requests work as expected, I didn't test whether the tracking works correctly on Matomo, but looks good.

integreat_cms/api/decorators.py Show resolved Hide resolved
integreat_cms/api/decorators.py Outdated Show resolved Hide resolved
integreat_cms/api/decorators.py Outdated Show resolved Hide resolved
Copy link
Member

@timobrembeck timobrembeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@svenseeberg svenseeberg merged commit 7efa455 into develop Feb 20, 2022
@svenseeberg svenseeberg deleted the feature/matomo-tracking branch February 20, 2022 16:42
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

Successfully merging this pull request may close these issues.

API hit tracking with Matomo
2 participants