# 🛠technical-support
Otter
Otter·4 replies

Hi, i have an issue on my widget Yourgpt. I try to identify my admin user for my web site. Mais, dans le panneau YourGpt, j’ai "VisitorXXX" tout le temps... My code :

Sahil | YourGPT
Sahil | YourGPT24/08/2025 16:13

hello @Otter Let me check this. Do you get any logs when running the SDK methods? also can you share your widget uid ?

Otter
Otter25/08/2025 09:29

Hello @Sahil , I don’t have logs. I set visitor data and it works, but not contact:data... I don’t understand why

@php $userId = loggedAdmin()->id; $secret = env("YOURGPT_SECRET_KEY"); $hmac = hash_hmac('sha256', $userId, $secret); $email = loggedAdmin()->email; $userName = loggedAdmin()->fullname; @endphp

    window.YGC_WIDGET_ID = "1196b33a-9625-436f-b8f6-45ade5842237";

(function () {
    var script = document.createElement('script');
    script.src = "https://widget.yourgpt.ai/script.js";
    script.id = 'yourgpt-chatbot';
    document.body.appendChild(script);

    // Attendre que yourgptChatbot soit défini
    function setUserData() {
        if (typeof $yourgptChatbot !== "undefined") {
            $yourgptChatbot.set("contact:data", {
                email: "[email protected]",
                phone: "+33766149820",
                name: "{{ $userName }}",
                ext_user_id: "{{ $userId }}",
                external_user_id: "{{ $userId }}",
            });
            $yourgptChatbot.set("visitor:data", {
                email: "[email protected]",
                name: "{{ $userName }}",
            });
            console.log($yourgptChatbot)
        } else {
            setTimeout(setUserData, 50);
        }
    }

    setUserData();
})();
Sahil | YourGPT
Sahil | YourGPT26/08/2025 10:45

We are reviewing this. Basically, if the HMAC is created with the correct key and includes one of the credentials (either the user ID or email) as specified in the documentation, it should work. However, we’ll continue reviewing and let you know if we find any issues. We may also improve the logs so that you can check whether you are receiving any errors on your side.

Otter
Otter26/08/2025 17:37

Ok thanks @Otter . I tried to set session:data and it's works !

@php $userId = loggedAdmin()->id; $secret = env("YOURGPT_SECRET_KEY"); $hmac = hash_hmac('sha256', $userId, $secret); $email = loggedAdmin()->email; $userName = loggedAdmin()->fullname; @endphp

    window.YGC_WIDGET_ID = "1196b33a-9625-436f-b8f6-45ade5842237";

(function () {
    var script = document.createElement('script');
    script.src = "https://widget.yourgpt.ai/script.js";
    script.id = 'yourgpt-chatbot';
    script.onload = function () {
        // Quand le script est chargé, on attend que le chatbot s'initialise
        $yourgptChatbot.on("init", function () {
            console.log("Chatbot initialized");

            $yourgptChatbot.set("contact:data", {
                email: "{{ $email }}",
                phone: "+33766149820",
                name: "{{ $userName }}",
                ext_user_id: "{{ $userId }}",
                external_user_id: "{{ $userId }}",
                user_hash: "{{ $hmac }}",
            });

            $yourgptChatbot.set("visitor:data", {
                email: "{{ $email }}",
                name: "{{ $userName }}",
            });

            $yourgptChatbot.set("session:data", {
                email: "{{ $email }}",
                name: "{{ $userName }}",
            });

            console.log("User data sent to chatbot");
        });
    };
    document.body.appendChild(script);
})();

I console.log contact:data and it appears well in the console, but on the YourGpt panel it’s not good, I don’t know why. I tried with an HMAC key in base 64 but same problem, it doesn’t go back to YourGpt. I tried to modify the secret key in order to have an identification error and I do indeed have the error. So a priori, the HMAC key and the user identifier are the right ones.