Closed kamaravichow closed 9 months ago
@kamaravichow you can disable them, check the documentation https://posthog.com/docs/libraries/flutter
Android:
<meta-data android:name="com.posthog.posthog.TRACK_APPLICATION_LIFECYCLE_EVENTS" android:value="false" />
iOS:
<key>com.posthog.posthog.CAPTURE_APPLICATION_LIFECYCLE_EVENTS</key>
<false/>
Web
<!-- posthog -->
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('phc_e9hZMrbbewlycMR1qlcqyZ9jRwKofloONLwe5cqSxKL', {api_host: 'https://app.posthog.com', autocapture: false})
</script>
{api_host: 'https://app.posthog.com', autocapture: false}
For the web you can also disable it remotely via project configuration. https://us.posthog.com/project/{your_project_id}/settings/project-autocapture
Problem Statement
Auto events like app open, backgrounded are wasting events counts, It would be really helpful to disable auto capture events for flutter sdk.
Solution Brainstorm
Autocapture - NOT GOOD
PostHog autocapture automatically tracks the following events for you:
Application Opened - when the app is opened from a closed state or when the app comes to the foreground (e.g. from the app switcher) Application Backgrounded - when the app is sent to the background by the user Application Installed - when the app is installed. Application Updated - when the app is updated.