I am new to Pirsch and integrating analytics with the server-side implementation.
I have trouble setting up the server-side integration in my Laravel ( PHP ) project. I plan to use Pirsch to track both web ( the standard server-side integration ) and CLI application events (I am unsure if it is possible).
I’ll explain what I tried to track the CLI app events ( but couldn’t make it work ) and you can help me if I am missing something.
The CLI events flow looks like the following
-
CLI application sends a post request to my ingest server ( ingest.my-site.com/events ) with the event details ( I am planning to use this for multiple CLI applications - and this will act as a proxy )
-
ingest server requests to pirsch hit endpoint
[https://api.pirsch.io/api/v1/hit
](https://api.pirsch.io/api/v1/hit) ( the data will look like below )
{
"url": "https://tools.my-site.com/error-finder", <<< this is a valid url which will return 200 status
"ip": "1.2.3.4", <<<<< this will be the cli app user's ip address
"user_agent": "My CLI App v0.0.1", <<<<< this will be dynamic based on the cli app
"accept_language": "en-us,en;q=0.5",
"referrer": "https://tools.my-site.com/error-finder"
}
- after a few seconds ( 5 in my case ) make the event request to the event endpoint
[https://api.pirsch.io/api/v1/event
](https://api.pirsch.io/api/v1/event) ( the data will look like below )
{
"url": "https://tools.my-site.com/error-finder",
"ip": "1.2.3.4",
"user_agent": "My CLI App v0.0.1",
"accept_language": "en-us,en;q=0.5",
"referrer": "https://tools.my-site.com/error-finder",
"event_name": "Error Found",
"event_meta": {
"errorTerm": "",
"box": "box-1",
"cli-app": "My CLI App v0.0.1",
"cli-app-user": "name of the user"
}
}
the weird part is that I am getting 200 as the response code for both requests but my data is not showing up properly in the dashboard (I was able to see some data so I thought I made it work and cleared the testing records by deleting the data and after that, it stopped working ).
I appreciate your help in making it work.