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

Add PostHog to ckan.org #209

Open
thegostev opened this issue Feb 6, 2024 · 7 comments
Open

Add PostHog to ckan.org #209

thegostev opened this issue Feb 6, 2024 · 7 comments
Assignees

Comments

@thegostev
Copy link

The idea for implementing Google Analytics was to add combine it with Google Ads seamlessly when promoting CKAN. This topic is closed for now and it's no reason to keep non-friendly to open-source big company product.

On the other hand we need web analytics. The topic is a bit tricky as not every system does the job right. I used PostHog (https://posthog.com/) for A/B tests on the web and was impressed by it:

  • It's open-source and free to use (1,000,000 events in free version is probably 10 times more that we'd use)
  • It offers solid set of tools
  • It's comfortable to use both on dev and UI side

This change might likely prompt to further website changes to refine call to actions, messaging we have and to refine the informational purpose of the website through testing copy and changes.

Update website through experimentation is a healthy way to deliver more value to visitors by understanding them better.

@popovayoana
Copy link

@thegostev @Alex-Pavlyuk I haven't used it so far but I'm totally in for giving it a shot. however, how about we don't replace but instead complement? we can run both GA and PostHog at the same time. it'll give us a solid mix of familiar and new while we get up to speed with PostHog (there's a bit of a learning curve...). let me know what you think and cheers for leading the way, @thegostev! ; )

@Alex-Pavlyuk
Copy link
Member

I have only one concern regarding the payment plan. This site can potentially be DDoSed (we have flood incidents already which means extra clicks\events). It can increase the number of events significantly and cost us something.
Various events have various cost, probably we need to understand what type of events do we want to track, and how every extra million will cost for us monthly.

@Alex-Pavlyuk Alex-Pavlyuk added the question Further information is requested label Feb 19, 2024
@thegostev
Copy link
Author

@Alex-Pavlyuk I'd be surprised if we'd use 5% of the free plan. No need to worry going off limits.

@thegostev thegostev removed their assignment Feb 23, 2024
@thegostev thegostev changed the title Exchange Google Analytics for PostHog Add PostHog to ckan.org Feb 23, 2024
@thegostev
Copy link
Author

Additional script for enabling Sessions Replays. Below are 2 possible options, just pick one:

Integrate PostHog with JavaScript web

Install

npm install posthog-js
# OR
yarn add posthog-js
# OR
pnpm add posthog-js

Initialize

import posthog from 'posthog-js'

posthog.init('phc_zjhMXcYodTdsui69Src7Y133OnOx5tPmmR55K7qLFZv', { api_host: 'https://app.posthog.com' })

Integrate PostHog with HTML

Install

Just add this snippet to your website within the tag and you'll be ready to start using PostHog. This can also be used in services like Google Tag Manager.

<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 onSessionId".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_zjhMXcYodTdsui69Src7Y133OnOx5tPmmR55K7qLFZv',{api_host:'https://app.posthog.com'})
</script>

@Alex-Pavlyuk Alex-Pavlyuk added in progress the work is in progress and removed question Further information is requested labels Apr 9, 2024
@Alex-Pavlyuk Alex-Pavlyuk assigned thegostev and unassigned alexmorev May 22, 2024
@Alex-Pavlyuk Alex-Pavlyuk added in testing and removed in progress the work is in progress labels May 22, 2024
@Alex-Pavlyuk
Copy link
Member

@thegostev pls check now

@popovayoana
Copy link

popovayoana commented May 22, 2024

@thegostev @Alex-Pavlyuk i didn't know we're moving on with this. can you summarize what's the status here, how does it affect our current setup and also how do i set things up? thanks.

@thegostev
Copy link
Author

@Alex-Pavlyuk data is there, looks good 👍

It says that "Your PostHog SDK needs updating. The latest version of posthog-js is 1.133.0, but you're using 1.131.2." the link leads to https://posthog.com/docs/libraries/js

Would it be possible to update the SDK?

@popovayoana I don't expect any changes. What's your concern?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants