A GoLang REST API server for creating and tracking email pixel tracker images.
- Go
- QuestDB
- PostgreSQL (To connect to QuestDB using PSQL wire protocol)
- Git
- Clone the repo
git clone https://github.com/colt005/TrackPixel.git
-
Download and install Quest DB, then run it locally or deploy it on a server.
-
Set up environment variables
export PORT=<Port you want to run the server on>
export BASE_URL=<Base url of the server use `http://localhost$PORT` if running locally>
export CONN_STRING=<Connection url of the PSQL wire protocol which questDB exposes. If the QuestDB is running locally it will be `postgresql://admin:quest@localhost:8812/qdb` >
- Build binary
go build -o TrackPixel
- Use the binary to run local server
./TrackPixel
Check if the API is running.
Response
{
"data": "Pixel tracker API running smoothly",
"status": "success"
}
Generate an image for the user to incorporate in an email and track email statistics.
Response
{
"image_url": "http://localhost:8000/image/3DjwvFjAjG8uZOPN.png",
"unique_code": "3DjwvFjAjG8uZOPN"
}
This produced image url
can be pasted into an email message.
Get statistics on the generated image and how it's being used in emails and other places.
Path Parameters
:uniqueCode
- The generated unique code
Response
{
"uri": "KgQR3dvAeImUpfkz",
"total_opens": 4,
"created_at": "2022-06-16T23:00:21.453445Z",
"timeseries_data": [
{
"uri": "KgQR3dvAeImUpfkz",
"time_stamp": "2022-06-16T23:04:01.456028Z",
"ip_address": "127.0.0.1"
},
{
"uri": "KgQR3dvAeImUpfkz",
"time_stamp": "2022-06-16T23:04:07.951854Z",
"ip_address": "127.0.0.1"
},
{
"uri": "KgQR3dvAeImUpfkz",
"time_stamp": "2022-06-16T23:04:09.220944Z",
"ip_address": "127.0.0.1"
},
{
"uri": "KgQR3dvAeImUpfkz",
"time_stamp": "2022-06-16T23:04:10.544438Z",
"ip_address": "127.0.0.1"
}
]
}
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project uses QuestDB which is one of the fastest open source time series database.