W
Wasp-lang•7mo ago
Karan

Disable Plausible and enable Google Analytics

I keep seeing this on server side logs. Can you tell me how I can disable Plausible and enable Google Analytics? Right now I am changing the code imports in calculateDailyStats.js manually before my deploy (yet to test this out):
// import { getDailyPageViews, getSources } from './plausibleAnalyticsUtils.js';
import { getDailyPageViews, getSources } from './googleAnalyticsUtils.js';
// import { getDailyPageViews, getSources } from './plausibleAnalyticsUtils.js';
import { getDailyPageViews, getSources } from './googleAnalyticsUtils.js';
[ Server!] Error calculating daily stats: Error: HTTP error! Status: 404
[ Server!] at getTotalPageViews (/Users/karankrishnani/projects/experiments/test-open-saas/app/src/server/workers/plausibleAnalyticsUtils.ts:46:11)
[ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[ Server!] at getDailyPageViews (/Users/karankrishnani/projects/experiments/test-open-saas/app/src/server/workers/plausibleAnalyticsUtils.ts:28:22)
[ Server!] at calculateDailyStats (/Users/karankrishnani/projects/experiments/test-open-saas/app/src/server/workers/calculateDailyStats.ts:43:55)
[ Server!] at async resolveWithinSeconds (/Users/karankrishnani/projects/experiments/test-open-saas/app/node_modules/pg-boss/src/manager.js:34:14)
[ Server!] at async /Users/karankrishnani/projects/experiments/test-open-saas/app/node_modules/p-map/index.js:57:22
[ Server!] Error calculating daily stats: Error: HTTP error! Status: 404
[ Server!] at getTotalPageViews (/Users/karankrishnani/projects/experiments/test-open-saas/app/src/server/workers/plausibleAnalyticsUtils.ts:46:11)
[ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[ Server!] at getDailyPageViews (/Users/karankrishnani/projects/experiments/test-open-saas/app/src/server/workers/plausibleAnalyticsUtils.ts:28:22)
[ Server!] at calculateDailyStats (/Users/karankrishnani/projects/experiments/test-open-saas/app/src/server/workers/calculateDailyStats.ts:43:55)
[ Server!] at async resolveWithinSeconds (/Users/karankrishnani/projects/experiments/test-open-saas/app/node_modules/pg-boss/src/manager.js:34:14)
[ Server!] at async /Users/karankrishnani/projects/experiments/test-open-saas/app/node_modules/p-map/index.js:57:22
7 Replies
kapa.ai
kapa.ai•7mo ago
Hi @Karan. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources provided, there isn't specific information on how to disable Plausible and enable Google Analytics in Wasp. However, from the Discord support thread, it seems that you are on the right track by changing the imports in calculateDailyStats.js. The error you're seeing seems to be related to the getTotalPageViews function in plausibleAnalyticsUtils.ts file. It's throwing a 404 not found error, which suggests that the function is trying to fetch data from a resource that doesn't exist or isn't accessible. If you're switching to Google Analytics, you would need to ensure that the getDailyPageViews and getSources functions in googleAnalyticsUtils.js are correctly implemented to fetch data from Google Analytics. Remember to also update any environment variables or configurations related to Plausible to match Google Analytics. If you continue to encounter issues, it would be helpful to check the logs for more detailed error messages or consider opening a Github issue in the Wasp repository for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Karan, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Karan
KaranOP•7mo ago
I can confirm I am not seeing the plausible errors in the Production logs anymore - so the manual change is working - but there really needs to be a way to configure this from wasp build process
MEE6
MEE6•7mo ago
Wohooo @Karan, you just became a Waspeteer level 2!
Filip
Filip•7mo ago
Hi @Karan, not quite sure I get the issue. Doesn't changing the code in src/server/workers/calculateDailyStats.ts do exactly what you need? 😄 Why are you changing the generated code?
Karan
KaranOP•7mo ago
Hey @sodic the reason I am changing the generated code is because I couldn't find a way to turn off collecting of daily stats from plausible. It's the default. But I want to use Google Analytics since plausible is paid from what I could see.
Filip
Filip•7mo ago
Doesn't changing the code in src/server/workers/calculateDailyStats.ts do exactly what you need? 😄
But what about this?
Karan
KaranOP•7mo ago
Ah yes. For some reason I thought the file is only in the generated code. My mistake. Thank you for pointing that out. I will make my change in my application code and we should be good to go.
Want results from more Discord servers?
Add your server