Hi @hypotato ,
Thanks for writing into Amplitude Community!
Do you own the subdomain? In this case, it would be following the cross-domain tracking article that you linked. Device IDs can be merged together as described n the article. If you have a matching Device ID for the user between the web flow and the back end, they should be able to merge on that unless there are several users using the same Device ID, which could make it tricky. You would need to be able to pass the Device ID between the two flows. Do you think you can reach out to the provider of the
third party auth0 page and see if they can pass the Device IDs for you? This would unfortunately be the only way we would have and we have no methods for getting around third party auth0 pages unless you reach out to them and see if they would allow you to pass the Device ID as some other customers have done this.
I hope this helps! Let me know if you have any other questions that I can help you!
Kind Regards,
Denis
Thanks @Denis Holmes. Yep, we own the subdomain as well.
If we own the domain that our webflow landing page is on and have amplitude there, and we own our subdomain that our web app is on as well, and also have amplitude there, will Amplitude produce the same device ID for both our landing page and our web app and automatically merge them together?
Or do we have to explicitly pass the device id between the sites as you mentioned? (e.g. if our landing page is mydomain.com, and our web app is on app.mydomain.com)
Thanks!
Hi @hypotato ,
Thanks for the reply! You would need to explicitly pass the Device ID between the sites and then when it is passed and assigned to the new user, Amplitude will know “Ah, this new user is the same as this other user on the landing page” and then merge them together :)
I hope that helps! :D
Thanks @Denis Holmes !
Possibly a separate question, but I’m having difficulty retrieving the Device ID on my Webflow page. I’ve tried using amplitude.getInstance().options.deviceId; but it returns with this error:
Cannot read properties of undefined (reading 'deviceId')
I’ve also tried Amplitude.getInstance().getDeviceId() but it says that getDeviceId is not a function. These are being adding this to the Head HTML code right after amplitude.getInstance().init() on my webflow site.
Is the Device ID not being set or could I be accessing it incorrectly? I’ve tried adding this as a callback function as part of .init() or .getInstance().onInit() as well but both of those still return the same errors.
Hey @hypotato ,
I think this is the order of things. If you want to set your own Device ID, I would do that first. Otherwise, I would log an event first and then get the Device ID. Such as ;
var text = amplitude.getInstance().options.deviceId;
Can you see if that helps? Thank you!
Edit: ignore this, but leaving the question here in case it’s useful for anyone in the future. I made a mistake by calling amplitude.getInstance() inside the callback function for init(), when instead the instance is actually passed an argument. So getting the device id is actually just instance.options.deviceId; Thanks Denis!
Hi @Denis Holmes ,
Even after logging an event, it still shows this:
:Amplitude] TypeError: Cannot read properties of undefined (reading 'deviceId')
This is what I have in my HTML <head> code in webflow:
amplitude.getInstance().init("<MY_API_KEY>", null, {
saveEvents: true,
includeGclid: true,
includeUtm: true,
includeReferrer: true
}, function() {
var eventProperties = {
'page_type': ‘landing_page’
};
amplitude.getInstance().logEvent('page visit', eventProperties);
var device_id = amplitude.getInstance().options.deviceId;
console.log(device_id);
});
I’m already only calling amplitude.getInstance().options.deviceId; in the callback function after initialization, and I’ve also added a logEvent() before that, but it still says that deviceId is undefined. Could I still be missing a step, or perhaps my order might still be incorrect?
Hi @hypotato !
Apologies, I was out sick for a few days. It looks like you were able to get this to work! Can you confirm for me? Thank you!
Hey @Denis Holmes , all good—it works nicely! Thanks for your help and hope you’re better :)
Sounds good @hypotato ! Thank you for your kind words If you have any other issues, feel free to post again at any time, happy to help!