JS API visitor attributes

Hello,

what other attributes in addition to name,email are available in Tawk_API.visitor?

Is userID supported ?
Is it possible to set Organization? I can create a new custom attribute but would be nice to link user directly to organization.

Janek

1 Like

Could you solve this?

1 Like

I too would like this as Organizations are first-class citizens in the workspace but there seems to be no way to set those properties from the javascript API.

Hello Janek,

Generally, the userID is reserved to be used in our system. You can rename as other.

Regarding on the other attributes, you are allowed to create custom in the tawk.to Dashboard’s Admin> Settings > Contact Attributes

Thank you

@zandro it is mentioned in the docs for the login method that “userId property will be a string that will be provided by the third party users.” Does this not imply that we can provide the IDs of our users as userId for our own reference? The docs for setAttributes imply we can provide an id field but it does not show up in the UI. The userId field does show up with the value i set, as “Userid” (exactly like that), so it is not clear which of these is intended for our user IDs and what is supposed to be reserved for internal use.

Hello @barnacle.m @Janek @Meerbex

If you use userID in the setAttributes it will be dropped by the server. I would suggest create a custom attributes as replacement of UserID under Administration > Contact attributes.

Because setAttributes is mainly for setting a data in default or custom attributes after or before widget loads. If you still wish to use UserID please use visitor If your data is ready before you load the widget, this is the best API to be use since it’s updating in the dashboard faster than setAttributes.

The docs do not make this clear. The example you have for login suggests you can pass userId as an attribute that is accepted by the server. When I use setAttributes I pass both “id” and “userId” and it appears that at least one of those is accepted by the server because “userId” shows up with the intended value. Please can you update the docs for both of these methods to make clear how they’re intended to be used? I’m not even using the login method because setAttributes seems to do the same thing without the trouble.