Skip to content
This repository was archived by the owner on Jan 2, 2024. It is now read-only.

Commit f9c120f

Browse files
committed
Docs
1 parent d224466 commit f9c120f

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Add the directive somewhere after initializing/configuring GA. The POST request
5959
</script>
6060
```
6161

62-
If you don't use Axios, you have to implement this call by yourself.
62+
If you don't use Axios, you have to implement this call by yourself. By default the endpoint is `/gaid` but you can customize it in the configuration file. The request is handled by the `ProtoneMedia\AnalyticsEventTracking\Http\StoreClientIdInSession` class. Make sure to also send the [CSRF token](https://laravel.com/docs/7.x/csrf).
6363

6464
## Broadcast events to Google Analytics
6565

@@ -165,9 +165,9 @@ class OrderWasPaid implements ShouldBroadcastToAnalytics
165165
You can configure some additional settings in the `config/analytics-event-tracking.php` file:
166166

167167
* `use_ssl`: Use SSL to make calls to GA
168-
* `anonymize_ip`: Anonymize IP when making calls to GA
168+
* `anonymize_ip`: Anonymizes the last digits of the user's IP
169169
* `send_user_id`: Send the ID of the authenticated user to GA
170-
* `queue_name`: Specify a queue to make the calls to GA
170+
* `queue_name`: Specify a queue to perform the calls to GA
171171
* `client_id_session_key`: The session key to store the Client ID
172172
* `http_uri`: HTTP URI to post the Client ID to (from the Blade Directive)
173173

config/config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
'use_ssl' => true,
1414

1515
/**
16-
* Anonymize IP when making calls to GA.
16+
* Anonymizes the last digits of the user's IP.
1717
*/
1818
'anonymize_ip' => true,
1919

2020
/**
2121
* Send the ID of the authenticated user to GA.
2222
*/
23-
'send_user_id' => true,
23+
'send_user_id' => false,
2424

2525
/*
2626
* This queue will be used to perform the API calls to GA.

src/Http/StoreClientIdInSession.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
namespace ProtoneMedia\AnalyticsEventTracking\Http;
44

5+
use Illuminate\Http\JsonResponse;
56
use Illuminate\Http\Request;
67

78
class StoreClientIdInSession
89
{
9-
public function __invoke(Request $request, ClientIdSession $clientIsSession)
10+
/**
11+
* Stores the posted Client ID in the session.
12+
*/
13+
public function __invoke(Request $request, ClientIdSession $clientIsSession): JsonResponse
1014
{
11-
$data = $request->validate(['id' => 'required']);
15+
$data = $request->validate(['id' => 'required|string|max:255']);
1216

1317
$clientIsSession->update($data['id']);
1418

0 commit comments

Comments
 (0)