Skip to content

Instantly share code, notes, and snippets.

@tnorthcutt
Created December 10, 2018 01:02
Show Gist options
  • Save tnorthcutt/930fca70f68949a5a54ee98ae0da04bd to your computer and use it in GitHub Desktop.
Save tnorthcutt/930fca70f68949a5a54ee98ae0da04bd to your computer and use it in GitHub Desktop.
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