当前位置:网站首页>Server to server (S2S) event (adjust)
Server to server (S2S) event (adjust)
2022-07-07 13:27:00 【Daisy knowledge】
<?php
namespace App\Services;
use App\Models\GoogleAffiliateModel;
use Illuminate\Support\Facades\Http;
class AdjustService
{
protected $adjust_event_uri;
protected $app_token; // On the control panel Adjust Application ID
protected $s2s; //s2s Parameter set to 1
protected $environment;
public function __construct()
{
$this->s2s = 1;
$this->app_token = 'xxxxxxxx';
$this->adjust_event_uri = 'https://s2s.adjust.com/event';
if (app()->environment('production')) {
$this->environment = 'production';
} else {
$this->environment = 'sandbox';
}
}
/** * adjust Report data events */
public function adjustUpload($order)
{
// Get google advertisement ID notes : From the client to the server
$googleAdId = 'xxxxxxxxx';
if (empty($googleAdId)) {
return;
}
// Pass the parameters of the request
$request = [
's2s' => $this->s2s,
'gps_adid' => $googleAdId, // Currently only for Android (android:gps_adid ios:idfa)
'app_token' => $this->app_token,
'event_token' => 'xxxxxxx', // On the control panel Adjust Event ID
'created_at_unix' => time(),
'revenue' => $order->amount,
'currency' => $order->currency,
'orderId' => $order->id,
'environment' => $this->environment
];
$response = Http::asForm()->withHeaders(['Content-Type' => 'application/x-www-form-urlencoded'])->post($this->adjust_event_uri, $request);
\Log::info("adjust Report {
$order->item_category->label()} Event response parameters ", [
'request' => $request,
'responseStatus' => $response->status(),
'responseJson' => $response->json()
]);
if ($response->successful()) {
return $response->json();
}
\Log::error("adjust Report {
$order->item_category->label()} Event failed .");
}
}
边栏推荐
- PACP学习笔记三:PCAP方法说明
- Initialization script
- Introduce six open source protocols in detail (instructions for programmers)
- 【学习笔记】zkw 线段树
- Go language learning notes - structure
- Why can basic data types call methods in JS
- 简单好用的代码规范
- Grep of three swordsmen in text processing
- 如何让electorn打开的新窗口在window任务栏上面
- RealBasicVSR测试图片、视频
猜你喜欢

LIS 最长上升子序列问题(动态规划、贪心+二分)

LED light of single chip microcomputer learning notes

JS缓动动画原理教学(超细节)

Japanese government and enterprise employees got drunk and lost 460000 information USB flash drives. They publicly apologized and disclosed password rules
![[learning notes] zkw segment tree](/img/18/21f455a06e8629243fc5cf4df0044c.png)
[learning notes] zkw segment tree

Isprs2021/ remote sensing image cloud detection: a geographic information driven method and a new large-scale remote sensing cloud / snow detection data set

我那“不好惹”的00后下属:不差钱,怼领导,抵制加班
![[learning notes] agc010](/img/2c/37f2537a4dadd84adacf3da5f1327a.png)
[learning notes] agc010

How far can it go to adopt a cow by selling the concept to the market?

Differences between MySQL storage engine MyISAM and InnoDB
随机推荐
Realbasicvsr test pictures and videos
Distributed transaction solution
DrawerLayout禁止侧滑显示
迅为iTOP-IMX6ULL开发板Pinctrl和GPIO子系统实验-修改设备树文件
QQ medicine, Tencent ticket
学习突围2 - 关于高效学习的方法
[dark horse morning post] Huawei refutes rumors about "military master" Chen Chunhua; Hengchi 5 has a pre-sale price of 179000 yuan; Jay Chou's new album MV has played more than 100 million in 3 hours
About the problem of APP flash back after appium starts the app - (solved)
cmake 学习使用笔记(一)
My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
我那“不好惹”的00后下属:不差钱,怼领导,抵制加班
Vscode编辑器ESP32头文件波浪线不跳转彻底解决
OSI 七层模型
高端了8年,雅迪如今怎么样?
分屏bug 小记
靠卖概念上市,认养一头牛能走多远?
Day26 IP query items
Differences between MySQL storage engine MyISAM and InnoDB
leecode3. 无重复字符的最长子串
服务器到服务器 (S2S) 事件 (Adjust)