@@ -187,54 +187,6 @@ foreach ($visitors as $collection) {
187187
188188```
189189
190- ### Frontend => Backend
191-
192- #### Frontend
193-
194- ``` js
195- // array< array< eventName, array<eventParams> > >
196- axios .post (" /your-api-endpoint/ga4-event-receiver" , [
197- // Note each event is its own object inside an array as
198- // this allows to pass the same event type multiple times
199- {
200- addToCart: {
201- currency: " EUR" ,
202- value: 13.37 ,
203- items: [
204- {
205- item_id: 1 ,
206- item_name: " Cup" ,
207- price: 13.37 ,
208- quantity: 1 ,
209- },
210- ],
211- },
212- },
213- ]);
214- ```
215-
216- #### Backend
217-
218- ``` php
219- use AlexWestergaard\PhpGa4\Helper\ConvertHelper;
220- use AlexWestergaard\PhpGa4\Exception;
221- use AlexWestergaard\PhpGa4\Analytics;
222- use AlexWestergaard\PhpGa4\Event;
223-
224- // require vendor/autoload.php
225-
226- try {
227- $events = ConvertHelper::parseEvents($_POST);
228-
229- Analytics::new($measurementId, $apiSecret)
230- ->addEvent(...$events)
231- ->post();
232- } catch (Exception\Ga4Exception $exception) {
233- // Handle exception
234- // Exceptions might be stacked, check: $exception->getPrevious();
235- }
236- ```
237-
238190## Custom Events
239191
240192You can build your own custom events. All you need is to implement and fullfill the ` AlexWestergaard\PhpGa4\Facade\Type\EventType ` facade/interface.
@@ -321,11 +273,6 @@ Two important points:
321273- Events sent to the Validation Server will not show up in reports.
322274- There is no way for events sent through measurement protocol (Server Side) to show up in the ` debugView ` in Google Analytics Admin.
323275
324- ## Additional information
325-
326- - Geographic information is only available via automatic collection from gtag, Google Tag Manager, or Google Analytics for Firebase.
327- - The ` page_view ` event works, however it's not documented in the official documentation, so do not rely on it.
328-
329276## Documentation
330277
331278- [ Measurement Protocol] ( https://developers.google.com/analytics/devguides/collection/protocol/ga4 )
0 commit comments