Mautic Community Forums

check if a guest is already a contact

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.

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 ?>

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.