Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PH : implement trackers in the website Lememe.fr #225

Open
zhinu opened this issue Sep 28, 2021 · 0 comments
Open

PH : implement trackers in the website Lememe.fr #225

zhinu opened this issue Sep 28, 2021 · 0 comments
Assignees

Comments

@zhinu
Copy link
Collaborator

zhinu commented Sep 28, 2021

Posthog has a way to automatically implements tracker into a html website by inserting a js component in the head node.

Autocapture
When you call posthog.init the PostHog JS library begins automatically capturing user events:

pageviews, including the URL
autocaptured events, such as any click, change of input, or submission associated with a, button, form, input, select, textarea, and label tags

Script to add in the header

<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".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('Project API Key', {api_host: 'https://app.posthog.com'})
</script>

The question remains on which account should we add this data, into the existing dismoi posthog that already recuperates data from the extension, or should we plan for another?

More info : https://posthog.com/docs/integrate/client/js

@MaartenLMEM MaartenLMEM changed the title PH : implement trackers in the website PH : implement trackers in the website Lememe.fr Oct 7, 2021
@MaartenLMEM MaartenLMEM transferred this issue from dis-moi/analytics Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants