Skip to main content
Answered

Logged out visitors website integration

  • 28 September 2022
  • 3 replies
  • 402 views

Forum|alt.badge.img+1

Hi,

 

I'm trying to install intercom onto my site for non signed in users. I've followed the instructions here: https://www.intercom.com/help/en/articles/167-install-intercom-on-your-website-to-engage-logged-out-visitors/p>

 

and it seems to half work but there's definitely something wrong. The chat window loads up and it's possible for me to send a message which makes its way to the inbox. However if I try to access the visitor ID with:

Intercom('getVisitorId')

it returns "undefined".

 

If I reload the webpage then my conversation history is gone and I see a background POST request in the web console that receives a 404 response (asterisks added for redaction of possibly sensitive info):

 

POST https://api-iam.eu.intercom.io/messenger/web/conversations/1************4
 
REQUEST
BODY:
 
app_id: m*******d
v: 3
g: undefined
s: dd*********************************b7
r:
platform: web
Idempotency-Key: 82************41
internal:
is_intersection_booted: null
page_title: MyPage
user_active_company_id: undefined
user_data: {}
self_serve_suggestions_match: false
client_assigned_uuid: null
referer: http://****.com/whatever/code>

Any idea what the problem may be?

Best answer by mateusz.leszkiewicz

Hi ​@joekeron42, It’s Mat from the Support Engineering Team 😀
 

If you're experiencing issues with the Intercom chat window for non-signed-in users, such as the Intercom('getVisitorId') returning "undefined," and conversation history disappearing on page reload, there are a few things you can check:

  • Ensure that the correct Intercom snippet is installed on your website. For tracking visitors/leads, the snippet should include only the app_id and not require a user_id or email. This allows Intercom to track visitors based on their browser cookie.
  • To verify if Intercom is installed correctly for visitors/leads, you can inspect the network requests in your browser's developer tools. Look for a request named "ping" and check the "Preview" area for the role attribute next to user. If it says "visitor_role" or "contact_role," then they're being recognized as a visitor or lead, respectively.
  • If Intercom('getVisitorId') is returning undefined, it could be due to using an outdated API. Consider updating to a newer version of the API that uses the search function instead. You can find the updated API documentation for searching via the email attribute here: Intercom API Docs.

If you've checked these aspects and the issue persists, it may be related to the specific setup or a bug, and further investigation into the console errors and network requests might be necessary to pinpoint the exact cause.

View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+1
  • Author
  • Active User
  • 10 replies
  • September 29, 2022

After further investigation I think what may be happening is the intercom widget is getting a bit confused as I have been testing with both my test workspace/app_id and also my prod one on the same site meaning I had a mix of intercom cookies from both apps.

 

I guess the widget doesn't check to make sure it uses the cookie relative to the app_id it is currently in use for? Obviously this is an unusual use case, but it's probably worth updating the widget to fix this issue in the future


Oseas
Employee
Forum|alt.badge.img+4
  • Employee
  • 103 replies
  • October 3, 2022

Hey @dan p12​ ! Oséas here from the Customer Support Specialist team 🕵️

 

We scope cookies to a workspace level for cases where Messengers associated with different workspaces might be installed on subdomains of the same domain. So that shouldn't be the problem in this case.

 

Are you using different app_id for both your test and prod workspaces when testing it?


mateusz.leszkiewicz
Intercom Team
Forum|alt.badge.img+5

Hi ​@joekeron42, It’s Mat from the Support Engineering Team 😀
 

If you're experiencing issues with the Intercom chat window for non-signed-in users, such as the Intercom('getVisitorId') returning "undefined," and conversation history disappearing on page reload, there are a few things you can check:

  • Ensure that the correct Intercom snippet is installed on your website. For tracking visitors/leads, the snippet should include only the app_id and not require a user_id or email. This allows Intercom to track visitors based on their browser cookie.
  • To verify if Intercom is installed correctly for visitors/leads, you can inspect the network requests in your browser's developer tools. Look for a request named "ping" and check the "Preview" area for the role attribute next to user. If it says "visitor_role" or "contact_role," then they're being recognized as a visitor or lead, respectively.
  • If Intercom('getVisitorId') is returning undefined, it could be due to using an outdated API. Consider updating to a newer version of the API that uses the search function instead. You can find the updated API documentation for searching via the email attribute here: Intercom API Docs.

If you've checked these aspects and the issue persists, it may be related to the specific setup or a bug, and further investigation into the console errors and network requests might be necessary to pinpoint the exact cause.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings