Skip to content

Commit

Permalink
Ignore Livewire requests in middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
zepfietje committed Aug 6, 2022
1 parent 4e0a3f4 commit 53c905c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.4.1] - 2022-08-06

### Fixed

- Ignore Livewire requests in middleware.

## [0.4.0] - 2022-07-17

### Changed
Expand Down Expand Up @@ -68,6 +74,8 @@

- TrackPageview middleware.

[0.4.1]: https://github.com/pirsch-analytics/laravel-pirsch/releases/tag/0.4.1
[0.4.0]: https://github.com/pirsch-analytics/laravel-pirsch/releases/tag/0.4.0
[0.3.2]: https://github.com/pirsch-analytics/laravel-pirsch/releases/tag/0.3.2
[0.3.1]: https://github.com/pirsch-analytics/laravel-pirsch/releases/tag/0.3.1
[0.3.0]: https://github.com/pirsch-analytics/laravel-pirsch/releases/tag/0.3.0
Expand Down
4 changes: 4 additions & 0 deletions src/Http/Middleware/TrackPageview.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public function terminate(Request $request, mixed $response): void
return;
}

if ($request->hasHeader('X-Livewire')) {
return;
}

Pirsch::track();
}
}

0 comments on commit 53c905c

Please sign in to comment.