docs/feat: Add targeting and security fields support to API and README docs

This commit is contained in:
Bartłomiej Janczak
2026-06-03 14:28:57 +02:00
parent 0349825890
commit 0d4eab2016
2 changed files with 15 additions and 0 deletions

View File

@@ -592,6 +592,11 @@ curl -X POST https://yourdomain.com/api/short-url/links \
| `pixel_google_id` | string | ❌ | Google Tag / GA4 ID |
| `pixel_linkedin_id` | string | ❌ | LinkedIn Partner ID |
| `webhook_url` | string (URL) | ❌ | Per-link webhook endpoint |
| `targeting_rules` | array | ❌ | JSON targeting rules (device, geo, rotation, language) |
| `password` | string | ❌ | Access protection password |
| `show_warning_page` | boolean | ❌ | Show safety warning page before redirect |
| `track_visits` | boolean | ❌ | Track visitor clicks and logs |
| `track_browser_language` | boolean | ❌ | Track visitor browser language locale |
**Response:** `201 Created` with the created link object.

View File

@@ -61,6 +61,11 @@ class ShortUrlApiController extends Controller
'pixel_google_id' => 'nullable|string|max:100',
'pixel_linkedin_id' => 'nullable|string|max:100',
'webhook_url' => 'nullable|url|max:2048',
'targeting_rules' => 'nullable|array',
'password' => 'nullable|string|max:255',
'show_warning_page' => 'nullable|boolean',
'track_visits' => 'nullable|boolean',
'track_browser_language' => 'nullable|boolean',
]);
$shortUrl = $this->service->create($validated);
@@ -108,6 +113,11 @@ class ShortUrlApiController extends Controller
'pixel_google_id' => $link->pixel_google_id,
'pixel_linkedin_id' => $link->pixel_linkedin_id,
'webhook_url' => $link->webhook_url,
'targeting_rules' => $link->targeting_rules,
'password' => $link->password,
'show_warning_page' => (bool) $link->show_warning_page,
'track_visits' => (bool) $link->track_visits,
'track_browser_language' => (bool) $link->track_browser_language,
'notes' => $link->notes,
'created_at' => $link->created_at->toIso8601String(),
];