Digital Synergy - AI Chatbot Enhancing WordPress Interactions

Navigating Chatbot Conversations: PHP Sessions and User IDs in WordPress

In order for the AI Powered Chatbot for WordPress plugin to keep track of conversations, PHP Session Ids are used to manage several things.

The first thing s session id is used for is to know which web page a visitor is on and which chatbot assistant is loaded on that page.  The second thing a session id is used for is to know which messages are linked to which conversation thread.

The chatbot obtains a session id when the plugin is loaded on the page.  It’s important to know which user is interacting with the chatbot.  Session id is used when the visitor is not logged into the website.  Once the user is logged in, then session id is replaced by user id.

In the screen capture below, you’ll see that a cookie is created called PHPSESSID.  In this case the “bfu71cohfs7a0tuu0ua5vp3pg0” is stored only for the duration of the session.  Notice that the “Expires / Max-Age” is set to “Session”.  So, the PHPSESSID should, in practice, be deleted at the end of the session.

Chatbot ChatGPT PHPSESSID
Chatbot ChatGPT PHPSESSID

In order to log and link conversations between the chatbot and the visitor either the Session id or the user id is used.  This allows for making sense of the message logged in the conversation log table in the WordPress database.

Since communication can be asynchronous and can cross multiple pages on the website, using an id is the best way to reassemble a conversation from the conversation log table.  An SQL query or export to Microsoft Excel then allows you to select or sort by the session id and order by the id key to assemble a conversation between a visitor and the chatbot.

In the screen capture below, you can see highlighted in yellow the session id “bfu71cohfs7a0tuu0ua5vp3pg0” for id 3 is a message from the visitor and item 4 is the response from the chatbot.  User id in the conversation log will be 0 when the visitor is not logged in, otherwise it will be the user id assigned by WordPress when the user was created.

Chatbot ChatGPT Conversation Log
Chatbot ChatGPT Conversation Log

If conversation logging is set to off on the Reporting tab in the Chatbot ChatGTP settings, then the conversation between the visitor – whether the user is logged in or not – will not be logged.  However, an interaction will be logged in the interactions table.  The interactions table just counts the number of times visitors have interacted with the chatbot.

Both the conversation log and the interaction tables can be downloaded from the Reporting tab.  You can export the data as a CSV file for further processing using other tools such as Microsoft Excel or the data can be loaded into another database for further analysis.

The potential uses of the conversation data are many, including apply some machine learning tools to the data to obtain deeper insights into who is engaging with the chatbot on your website and the type and nature of the conversation exchanges.

Two things to remember about the conversation logs.  First, proper disclosure that interaction between the chatbot and the visitor or signed in user is recorded.  And second, ensuring the security and privacy of any information collected – in both the WordPress database and elsewhere if the data is export – is also very important.  If you decide to turn on conversation logging, local rules and regulations may determine if and how the data must be stored and my be used.  Consult with the appropriate professionals for recommendations.

A future release of the chatbot will offer the option to present the chatbot only to logged in users.  This will be a global setting that will likely have three states: visitors only, users only, or both.  An optional parameter on the shortcode will be implemented as well thus allowing for additional control over when and where chatbot might be presented.

This will be ideal for website designers that want to offer one chatbot assistant for visitors and a different chatbot for authenticated users.

The AI Powered Chatbot for WordPress plugin continues to evolve.  That evolution is driven by the rapidly growing installed base of users.  I want to thank each of you for taking the time to share your valuable feedback, as it helps me continually improve and provide a better experience for all our users.

#WordPressChatbots #ChatbotTechnology #PHPsessions

About the Author

Stephen Howell is a multifaceted expert with a wealth of experience in technology, business management, and development. He is the innovative mind behind the cutting-edge AI powered Kognetiks Chatbot for WordPress plugin. Utilizing the robust capabilities of OpenAI's API, this conversational chatbot can dramatically enhance your website's user engagement. Visit Kognetiks Chatbot for WordPress to explore how to elevate your visitors' experience, and stay connected with his latest advancements and offerings in the WordPress community.

Stephen Howell
Stephen Howell is a multifaceted expert with a wealth of experience in technology, business management, and development. He is the innovative mind behind the cutting-edge AI powered Kognetiks Chatbot for WordPress plugin. Utilizing the robust capabilities of OpenAI's API, this conversational chatbot can dramatically enhance your website's user engagement. Visit Kognetiks Chatbot for WordPress to explore how to elevate your visitors' experience, and stay connected with his latest advancements and offerings in the WordPress community.
Posts created 75

Leave a Reply

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top