Skip to main content

Hello,

We are using Amplitude JavaScript SDK 5.2.2 in two separate applications, each of which is responsible for a certain part of our website and one was recently introduced.

 

We use Amplitude mainly to create funnels for A/B testing analysis. And currently the problem we are facing is that the logged events don’t link when user moves from one application to the other.
 

 

We created this funnel using an amplitude user property that we set in the first app based on the test variation with the assumption when user redirects to another page that is powered by the other app, the mentioned user property will persist in users’s current amplitude session.

I’m wondering what would be the best way to go about debugging this? I can confirm that we use the same SDK and code snippet in both applications and initializing amplitude with the same API key.

The main thing that I’m suspecting is an issue with device ID. Strangely enough, although we are using the same code snippet and API key, I can see two different device IDs logged from the Amplitude Event Explorer extension for each application.

I’d really appreciate a hint in the right direction :)

Thanks,
Nojan

It definitely has to do with the device IDs. For Amplitude to identify a user in App 1 as the same user in App 2, the device IDs have to be the same (or if there is a user ID, the user IDs have to be the same and device IDs can be different). I am much savvier about web implementation than app implementation, so unfortunately I cannot provide further debugging steps. I do know that our app generates a new device ID each time the users opens it/logs in, but because a user ID is present and does not change, the behavior is logged under the same profile.

I’m not sure if the regeneration of device ID is something that can be controlled with the implementation set up. But if you are able to set the same device ID and/or user ID across apps, you should be able to track users across apps


Hi @SheenaGreen , thanks for your response.

Sorry about my inaccurate description, but I was actually talking about 2 different web apps which are using different tech on the back-end side which should be irrelevant since we are utilizing amplitude using the JavaScript SDK on the client side.

As far as I can tell, we are not setting the device ID when initializing using the JS SDK.

Thank you!


Hi!

@SheenaGreen is on the right track!

When our JS SDK loads, we check the cookie to see if it has an Amplitude Device ID in it. If it does have a Device ID value that means the current user is a returning user and we will use the Device ID value was generated in a previous visit. If we don’t find a Device ID value the user is either a new user, or user recently cleared cookies so the JS SDK will randomly generate a new value, and also saves that new one to cookies.

 

In addition to that I would check your instrumentation to make sure you are not resetting Device ID values. Although you are not setting a Device ID there is a chance you are doing the following and re setting the Device ID value in your instrumentation:

https://developers.amplitude.com/docs/javascript#log-out-and-anonymous-users 

 

If you want to track on two different apps you should try setting up something similar to our cross domain tracking tips below. You will have to set it up on your end as this is a custom instrumentation. I am providing this as an example but you will have to set it up and test it with your developers! :

https://developers.amplitude.com/docs/advanced-settings#cross-domain-tracking-javascript

 

Hope this helps!

 

Best,

Sydney

 

 


Thanks for your response @sydney.koh !

We’ve managed to make the device ID persist between the two apps and now we’ve narrowed down the problem to the event IDs.

Seems like when user lands on the first app, the event IDs increment as expected. And when user navigates to a page served from the other app, it restarts from 1. And there’s even more inconsistency when they navigate to the other app again.

There is definitely something not quite right with our setup.

I replied only in case this event ID issue rings a bell for you and you are able to hint us in the right direction. And no worries if not :)

Thanks a lot!


Reply