# check if a guest is already a contact

**URL:** <https://forum.mautic.org/t/check-if-a-guest-is-already-a-contact/4369>\
**Category:** Product Support\
**Created:** [June 17, 2016, 3:10pm UTC](https://forum.mautic.org/t/check-if-a-guest-is-already-a-contact/4369 "2016-06-17T15:10:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sotiris](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@sotiris](https://forum.mautic.org/u/sotiris)\
**Post date:** [June 17, 2016, 3:10pm UTC](https://forum.mautic.org/t/check-if-a-guest-is-already-a-contact/4369/1 "2016-06-17T15:10:54Z")

</div>

Hi kuzmany ,  
  
  
  
i saw a reply of yours to a user asking about how to check if a guest is already a contact :  
  
  
  
you had replied :

Quote:

If you have mautic on same domain like website, you are able to get lead id from cookie.  
$sessionId = $\_COOKIE;  
$leadId = $\_COOKIE[$sessionId];

  
Can you please explain a bit more . My mautic installation is under the same domain but when i copy-paste this code and echo $leadid i get no reply . Any hint ? Should i activate or pre-install anything before fetching this data?  
  
Thank you for your time !  
  
PS: the website is in WP and i use the wp-mautic tracking pixel.

---

<div class="post-metadata">

**Author:** ![sotiris](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@sotiris](https://forum.mautic.org/u/sotiris)\
**Post date:** [June 17, 2016, 6:26pm UTC](https://forum.mautic.org/t/check-if-a-guest-is-already-a-contact/4369/2 "2016-06-17T18:26:33Z")

</div>

Thanks for the quick reply ! I’m working in firefox and open the chrome for mautic . I had this conflict in previous step when i couldnt track my own moves .

Is there any other possible mistake i do ? I just copy-paste and use these two lines of code ?? no other API configuration etc ?

Thanks for your time and interrest

PS : i wrap them within a visual-composer div as raw php \<?php code ?\>

---

<div class="post-metadata">

**Author:** ![sotiris](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@sotiris](https://forum.mautic.org/u/sotiris)\
**Post date:** [June 17, 2016, 3:10pm UTC](https://forum.mautic.org/t/check-if-a-guest-is-already-a-contact/4369/3 "2016-06-17T15:10:54Z")

</div>

Hi kuzmany ,

i saw a reply of yours to a user asking about how to check if a guest is already a contact :

you had replied :

[quote]If you have mautic on same domain like website, you are able to get lead id from cookie.  
$sessionId = $\_COOKIE[‘mautic\_session\_id’];  
$leadId = $\_COOKIE[$sessionId];[/quote]

Can you please explain a bit more . My mautic installation is under the same domain but when i copy-paste this code and echo $leadid i get no reply . Any hint ? Should i activate or pre-install anything before fetching this data?

Thank you for your time !

PS: the website is in WP and i use the wp-mautic tracking pixel.
