Solved

Why Platform and Country values not appear when using NodeJS SDK (NextJS)?

  • 21 February 2023
  • 5 replies
  • 205 views

Badge

Previously when I tested using Browser SDK the Platform and Country values are appear automatically. But when I try to implement using NodeJS SDK (I’m using Node Ampli Wrapper) the values was not appear. This also happens with Amplitude Event Explorer (Chrome Extension), it doesn’t work when using NodeJS SDK while using Browser SDK is works.

 

 

icon

Best answer by Saish Redkar 22 February 2023, 16:38

View original

5 replies

Userlevel 7
Badge +10

Hi @tech-melaka 

Are you capturing the IP address on the events via the SDK? Country property won’t be resolved until there is a valid IP address.

You might want to check your trackingOptions in both the SDK initialization steps to see where’s the issue

https://www.docs.developers.amplitude.com/data/sdks/typescript-browser/?h=setoptout#optional-tracking

Badge

I think that is setup for Browser SDK, and If I’m not mistaken setup for NodeJS SDK it was different as I saw in this references:
https://github.com/amplitude/ampli-examples/blob/main/node/nextjs/ampli-app/lib/init-ampli.ts

Badge

Hi @tech-melaka 

Are you capturing the IP address on the events via the SDK? Country property won’t be resolved until there is a valid IP address.

You might want to check your trackingOptions in both the SDK initialization steps to see where’s the issue

https://www.docs.developers.amplitude.com/data/sdks/typescript-browser/?h=setoptout#optional-tracking

Thanks for the answer, in my case I’m using NodeJS Ampli Wrapper for NextJS. Currently due to the NodeJS implementation, there is no browser optional tracking properties. Do I need Browser SDK as well to get the default value?

Userlevel 7
Badge +10

Okay, looks like the NodeJS SDK won’t have the IP, platform options since it’s a server side SDK.

https://www.docs.developers.amplitude.com/data/sources/client-side-vs-server-side/#client-side-sources

 

Badge

Resolved. If others come across the same issue, you can use Ampli Wrapper but using Browser SDK. I already try and it works https://www.docs.developers.amplitude.com/data/sdks/typescript-browser/ampli/

Reply