I hope you’re all doing well. I’m currently facing an issue retrieving campaign statistics via the API. I’ve tried using the endpoints api/stats and api/campaigns, but I haven’t been successful in accessing the specific statistics related to a campaign.
Has anyone encountered this issue before or found a reliable solution? I’d greatly appreciate any guidance or suggestions you could share.
Just to add that the most up to date content is at
The old docs at developer.mautic.org are there for legacy purposes, as we haven’t pulled all the content over yet, so there might be some content which is missing but the new devdocs site is the current one.
Thanks for your reply @joeyk I’m able to access some stats endpoint, but I’m still not getting the specific stats related to actions and decisions made within a particular campaign. I’ve gone through all the available stats tables, but none seem to show this information.
Conditions and decisions are stored not as simly readable statistics, but as an entry as “Yes branch choosen” for example. Or event completed time / event scheduled time.
You will need to build the stats from these building blocks.
Just look at the campaign related tables to understand the logic.
I think that is just for listing the events.
You would need to pull the data from the campaign_lead_event_log.
Each line is an event with scheduled date, completed date, yes/no path taken, etc.
I used the endpoint api/stats/campaign_lead_event_log, but the sample data I received doesn’t include any fields related to email opens or clicks, nor any values like "yes" in the JSON response.
Thanks once again for your reply. I will like to obtain specific statistics for the campaign—namely, the number of emails sent and the related interactions (opens, clicks, and page visits) like on the screenshort above for that particular campaign via an API. in resume decision, action and contact
you need to consrtuct this yourself by using the campaign_lead_event_log (for decisions), email_stats table (for email statistics), url_redirects and page_views (for clicks).
Check the tables above and you’ll see how it works.
Joey
On the email stats i have this structure below Please can i know the campaign which have sent this emails? What is the use of “source_id”: “12” How is it linked? thanks for your reply