Skip to main content

Hello everyone,

 

I try to use a snippet https://www.docs.developers.amplitude.com/data/sdks/javascript/#snippet for sending events, but I have a problem: function setEventProperties is undefined

 

// Original snippet

amplitude.getInstance().init("API token");

const instance = amplitude.getInstance();

instance.setDomain(location.host);
instance.setUserId('100500');
try {
instance.setEventProperties({'type': '...'});
}
catch (e) {
console.log(e); // instance.setEventProperties is undefined
}

amplitude.logEvent("event_name");

 

How can I set the event’s properties?

amplitude.logEvent("event_name", {‘type’: ‘my’}); - it solved


Reply