Skip to content

Commit

Permalink
minor fixes to handle parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
yeleleo committed Dec 14, 2020
1 parent 8ee6d97 commit 438f0c2
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 17 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ You are all set now.
#### <a id="logs"></a>Logging your results ####
If you want to store logs you need to create relevant directory:
```
$ mkdir logs
```
To disable logs just set it so in `adjust-config.php`
```
Expand Down
55 changes: 49 additions & 6 deletions modules/adjust-config-temp.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,58 @@ function config () {
],

'include_user' =>
[ 'ip_address', 'id' ],

'clean_keys' =>
[ 'user_id', 'transaction', 'sentry:user' ],
[
'ip_address',
'id'
],

'default_params' =>
[
[
'event_token' => 'adjust_event_token',
'app_token' => 'adjust_app_token',
's2s' => 1
]
'environment' => 'production'
],

'callback_params' =>
[
'user_id' => 'userID',
'release' => 'app_version',
'level' => 'error_level',
'transaction' => 'controller',
'os' => 'os_version',
'device' => 'device_version',
'user_email' => 'email'
],

'partner_params' =>
[
'release' => 'app_version'
],

'clean_keys' =>
[
'user_id',
'sentry:user',
'browser',
'browser.name',
'os.name',
'id',
'app.device',
'device',
'device.family',
'dist',
'handled',
'level',
'mechanism',
'os',
'os.name',
'os.rooted',
'push_token',
'release',
'transaction',
'user',
'user_id',
'email'
],
];
27 changes: 20 additions & 7 deletions modules/adjust-params.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,26 @@ function extract_user( &$params, $user ) {
function modify_params( &$params ) {
$params['sentry_user'] = explode( ':', $params['sentry:user'] )[1];

$params['callback_params'] = [
'user_id' => $params['user_id'],
];
$params['idfa'] = $params['ios_idfa'];

$params['partner_params'] = [
'push_token' => $params['push_token'],
];
callback_params( $params );
partner_params( $params );
}

function callback_params( &$params ) {
$params['callback_params'] = [];

foreach( config()->callback_params as $key => $value ) {
$params['callback_params'][$value] = $params[$key];
}
}

function partner_params( &$params ) {
$params['partner_params'] = [];

foreach( config()->partner_params as $key => $value ) {
$params['partner_params'][$value] = $params[$key];
}
}

function clean ( &$params ) {
Expand All @@ -47,7 +60,7 @@ function clean ( &$params ) {
}

foreach ( $params as $key => $value ) {
if ( empty( $value ) ) {
if ( empty( $value ) || $value === 'null' ) {
unset( $params[$key] );
}
}
Expand Down
4 changes: 0 additions & 4 deletions modules/adjust-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

function prep_url ( $url ) {
$res= $url;

if ( substr( $res, -1 ) !== '/' ) {
$res .= '/';
}

$res .= '?';

Expand Down

0 comments on commit 438f0c2

Please sign in to comment.