In this guide
- SendGrid's v3
mail/sendendpoint accepts a JSON request with an API key. A server container tag can call it. - Use it for simple notifications and internal alerts. For customer e-mail, use your shop or CRM with proper templates, consent and unsubscribe handling.
- Verify the sender and keep the API key in a secure field.
Occasionally you want an e-mail when an event happens: an internal alert, a simple confirmation. SendGrid has an HTTP API, and a server container can call it. This page shows how, and when you should not. API details change, so check SendGrid's documentation. See Slack notifications, Mailchimp from a server container and webhook servers.
What you need
- A SendGrid account and an API key with permission to send mail.
- A verified sender or domain.
- A server container tag that makes the request.
Connected in minutes
Add your domain, install the pixel, connect your ad platforms and watch the first events land.
The request
const sendHttpRequest = require("sendHttpRequest");
const JSON = require("JSON");
const getEventData = require("getEventData");
sendHttpRequest("https://api.sendgrid.com/v3/mail/send", (statusCode) => {
statusCode === 202 ? data.gtmOnSuccess() : data.gtmOnFailure();
}, {
method: "POST",
headers: {
"Authorization": "Bearer " + data.apiKey,
"Content-Type": "application/json"
},
timeout: 5000
}, JSON.stringify({
personalizations: [{ to: [{ email: data.to }] }],
from: { email: data.fromEmail },
subject: data.subject,
content: [{ type: "text/plain", value: data.body }]
}));A successful send usually returns status 202. Allow https://api.sendgrid.com/* in the template's permissions.
Good uses and bad uses
| Use | Verdict |
|---|---|
| Internal alert: "Large order received" | Good |
| A simple notification to your own team | Good |
| Marketing e-mail to customers | No. Use an e-mail platform with consent and unsubscribe handling |
| Order confirmations to customers | Better from your shop, which has the templates and the legal wording |
| Sending customer data to an external address | Be careful: minimise and document |
Watch events arrive, live
A sample feed. In Open Tracked you see the same stream for your own store.
Consent and law
- Marketing e-mail needs consent and an unsubscribe link in most places.
- Transactional e-mail has different rules, but still needs accuracy and a lawful basis.
- Do not send personal data to third parties without a basis.
Errors
A realistic example
A small shop wants an e-mail to its warehouse whenever an order contains a heavy item. It adds a tag to its server container that checks the items in each purchase and, if one is flagged heavy, calls SendGrid's mail/send endpoint with the order ID and the item list. It deliberately leaves the customer's details out, since the warehouse only needs the order number and can look up the rest in the shop. The shop keeps customer confirmations in its shop software, where the templates and unsubscribe handling live. The container handles what it is good at, reacting to events and passing small facts to another system, and leaves customer e-mail to tools built for it.
Keep it healthy
Check SendGrid's activity feed after launch to see delivery status, and make sure your sending domain is authenticated so alerts do not go to spam. Keep the API key restricted to the permissions it needs, and rotate it if anyone with access leaves.
Runs on your domain, anywhere
Your tracking runs on your own domain, so a visit from any country is handled the same way.
Frequently asked questions
Can a server container send e-mail?
Yes, by calling an e-mail API such as SendGrid's mail/send from a tag.
Should I send customer e-mail this way?
Usually no. Use your shop or an e-mail platform with templates and unsubscribe handling.
What status means success?
SendGrid usually returns 202 for an accepted message.
How do I keep the API key safe?
In a secure server-side field, with the template allowing only SendGrid's address.
Why does my e-mail not arrive?
Often an unverified sender or spam filtering.
Do I need spreadsheets to read my results?
No. Once tracking is live, the Open Tracked analytics shows spend, revenue, ROAS and profit, and you can ask Ari, the built-in AI assistant, questions about your own numbers in plain words. Ari's allowance depends on your analytics plan.
Is Open Tracked different from Open Track or Open Space Track?
No. Open Tracked is the official name of our server-side tracking platform, and the website is opentracked.io. Many people search for it as Open Track, OpenTrack or Open Space Track. All of them lead to the same product: server-side Google Tag Manager hosting, first-party analytics and a CRM pipeline.

Fix your tracking at the source
Open Tracked hosts your server-side Tag Manager, keeps first-party cookies alive and shows what each ad is really worth.
The Open Tracked team
We build Open Tracked: server-side tracking hosting, analytics and the tools around them, for stores that spend on ads. Questions about this guide, or an idea for the next one?
Comments
Loading comments...
