Hi! I am using capacitor js to share my react web ...
# support
b
Hi! I am using capacitor js to share my react web component across my web, android and ios apps. I started using rudderstack and noticed there is a common field called
channel
which accepts the values:
web
,
mobile
, etc. I made a custom hook called useAnalytics where I create the rudderstack instance and reuse it across pages and components on all three platforms to track different user actions. I was wondering if there was a way for me to change that channel attribute (or any better way) so that I could use this single react hook on all platforms and send my data to either an ios, android or web data source only by checking the platform at runtime and send the data with the right platform information attached to it. All I want in the end is to be able to look at my analytics per platform if I need to, or look at the big picture data for the 3 platforms combined. I'm trying not to do this in a messy way! Any ideas to help me on that case?
m
Hey There! 👋 Your message has been received by the RudderStack team. We will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
Hi Maxime, since you have the platform data with you won't it be possible to load the source based on the platform. Then you can use a custom field to send the platform information since the channel field only accepts `mobile`⁣, `web`⁣, `server`⁣ and `sources`⁣ values. I am curious to understand how you built this custom hook.
b
Hello. I've change my approach a bit. Now everything seems to be sending the information properly in the browser with a
user_platform
property but when I execute the call from my capacitor js webview that is my mobile app, I don't receive anything in the event monitoring. It fails silently. I wasn't able to find anything to help me debug that so far. Do you think there are some checks in the background that would prevent sending the data from a webview and just return without throwing anything?
m
Hi Maxime, I have posted this to the team and I will update you once I have some answers. The team also requested some time to do some research on this.
Hi Maxime, RudderStack does not currently have a capacitor SDK and the JS SDK will not be able to support both web and mobile.
b
Thanks a lot for the support!