PHP code example of darvis / livewire-google-analytics

1. Go to this page and download the library: Download darvis/livewire-google-analytics library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

darvis / livewire-google-analytics example snippets




namespace App\Livewire;

use Darvis\LivewireGoogleAnalytics\Traits\TracksAnalytics;
use Livewire\Component;

class ContactForm extends Component
{
    use TracksAnalytics;

    public string $email = '';

    public function submit(): void
    {
        $this->validate(['email' => '

$this->trackEventAfterRedirect('purchase', ['transaction_id' => 'T12345', 'value' => 25.99, 'currency' => 'EUR']);

$this->redirectRoute('orders.thanks');