Instantly share code, notes, and snippets.

Embed
What would you like to do?
Limiting user tracking in a Laravel Spark app to real users signed into the app (not admins or admins impersonating a user)
<script>
<?php if (Auth::user() && Spark::developer(Auth::user()->email) || session('spark:impersonator')) {
?> Spark.state.devmode = true; <?php
} else {
?> Spark.state.devmode = false; <?php
} ?>
if (Spark.state.user && !Spark.state.devmode) {
// Intercom, FullStory, etc. tracking goes here
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment