Frequently Asked Questions about Server-to-Server Integration (REST API)
This section answers your most common questions about using the Metrix REST API for sending data (Server-to-Server Integration).
1. What is Server-to-Server (S2S) Integration?
Server-to-Server integration (commonly referred to as S2S or Server-to-Server Integration) means sending data (such as events or user information) directly from your server to the Metrix server.
This model contrasts with using the Metrix SDK, where data is sent directly from the user’s device (Client-side) to Metrix via our SDK. In an S2S setup, your server acts as an intermediary between the user’s device and the Metrix server.
2. Why is Server-to-Server Integration important?
Using S2S can be very beneficial in various scenarios, especially when data is processed or confirmed on your server. Generally, this capability is recommended in four situations:
- Server-side event confirmation or processing: If critical events like a successful payment, invoice due date, or order status change are confirmed or processed on your server, sending them via S2S ensures higher accuracy and security.
- Limitations in editing the application’s source code: If your team cannot directly edit the app’s source code (for example, due to outsourcing development to a third party) or if it’s operationally difficult.
- Third-party SDK incompatibility with company policies: If default third-party SDKs do not comply with your company’s security or privacy policies (as an advertiser).
- Starting campaign tracking before an app update is released: If you want to start monitoring and tracking your campaigns before a new app update containing the Metrix SDK is published.
3. Should specific applications or businesses use this feature?
This feature is suitable for all applications and businesses across all sectors and provides a high degree of flexibility.
However, applications that manage off-app payments (such as banking, finance, and e-payment apps) or critical and sensitive processes on their server side (like transportation apps that redirect users to an external payment gateway) can gain significantly more value from this service. This approach ensures that vital data is sent to Metrix accurately and reliably.
4. Can I use both the SDK and the Metrix REST API simultaneously?
Yes, absolutely! The combined use of the SDK and the REST API is a powerful and highly recommended approach.
- SDK (Client-side): It is efficient for tracking everyday and general user interactions (like opening the app, viewing pages, clicks) that occur directly on the device.
- REST API (Server-to-Server): It is ideal for sending sensitive, important, or server-confirmed events (such as a final successful purchase, order completion, or events related to a user’s account status).
This combination ensures that you both fully collect interactive user data and maintain high accuracy and security for your business’s critical data.
5. Can the REST API be used from the client-side (browser/app)?
Yes, it is technically possible, but with important considerations!
You can send REST API requests directly from the client-side (for example, via JavaScript code in a browser or directly from a mobile app). However, you must be aware of the following points:
- API Key Type: In this case, you must use a Client-type API Key. Server API Keys are designed for use in secure server environments, and exposing them on the client-side can create serious security risks.
- Security: Sending API requests directly from the client-side poses a greater security risk, as your API Key will be accessible in the client’s code (even if obfuscated). This can allow attackers to send fake data using your key.
- Reliability: Client-to-server communications can be affected by factors such as the user’s internet connection, ad blockers, or browser errors, which can lead to data loss.
Our general recommendation is:
- For tracking user interactions on the client (like clicks, page views), use the Metrix SDK.
- For tracking sensitive and important business events that require server confirmation, use an S2S integration (from your server).
- Using the REST API directly from the client is only recommended in situations where the Metrix SDK is not available, the appropriate API Key type is used, and the security risks are accepted.
6. Is there a difference in the data collected between the SDK and the REST API?
Yes, there are key differences:
- Device/Client Information: The Metrix SDK automatically collects device-related information (such as device model, operating system, app version, IP, etc.) and campaign referral data (Attribution Data). In an S2S integration, you can collect this data manually (if needed) from your server and send it as parameters in your API requests.
- Organic/Non-Organic and Push Notification Tracking: The Metrix SDK is essential for tracking and attributing organic and non-organic installs. Furthermore, a user can only receive push notifications through the SDK. In an S2S integration, you primarily send events and user information.
- System Events: The Metrix SDK automatically tracks system events like
App InstalledandSession Started. These events must be implemented manually in S2S if required.- Note for Android: In specific cases on Android, it is possible to send your FCM tokens to Metrix and display pushes via the Firebase service, but this is a limited scenario. [//]: # ’---’ [//]: # ’### ۷. آیا میتوان از REST API برای ارسال دادههای مربوط به کاربران قدیمی (Historical Data) استفاده کرد؟’ [//]: # [//]: # ‘بله، REST API ابزار بسیار مناسبی برای ارسال دادههای تاریخی (Historical Data) به متریکس است.’ [//]: # [//]: # ‘اگر دارای پایگاه دادهای از کاربران قدیمی یا رویدادهای گذشته هستید و میخواهید این اطلاعات را به متریکس منتقل کنید، میتوانید از REST API برای ارسال دستهای (Bulk) این دادهها استفاده کنید. این کار به شما کمک میکند تا یک دید جامع و کامل از کاربران خود در متریکس داشته باشید، حتی اگر در گذشته SDK متریکس را پیادهسازی نکرده بودید.’ [//]: # [//]: # ’* لینک مرتبط: راهنمای استفاده از REST API برای ارسال دستهای (Bulk) رویدادها/کاربران ’