Visitor id is showing undefined

I am using Intercom(‘getVisitorId’) but getting undefined. Please help me to get the visitor id.Thanks in advance.