{"section":"tutorials","requestedLocale":"en","requestedSlug":"welcome-message-control","locale":"en","slug":"welcome-message-control","path":"docs/en/tutorials/storefront/layout/welcome-message-control.md","branch":"main","content":"The control `<vtex.cmc:welcomeMessage/>` renders a welcome message, which should be used in the store topbar.\n\nSee an example in the image below.\n\n![welcome1](https://cdn.statically.io/gh/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/storefront/layout/welcome-message-control_1.png)\n\n## HTML code rendered\n\nHere is an example of the code rendered by this control:\n\n```html\n<div class=\"welcome col-xs-5\">\n\t<script>\n\t    $(document).ready(function () {\n\t        vtexid.setScope('1acde8b8-c134-45ca-bda6-8496f39d6734');\n\t        vtexid.setScopeName('lojadobreno');\n\t        $('body').on('click', '#login', function () {\n\t            vtexid.start(\n\t                    {\n\t                        returnUrl: '/produto-teste/p',\n\t                        userEmail: '',\n\t                        locale: 'en-US',\n\t                        forceReload: false\n\t                    });\n\t        });\n\t    });\n\t</script>\n\t<div class=\"ajax-content-loader\" rel=\"/no-cache/user/welcome\">\n\t    <p class=\"welcome\">\n\t    Bem-vindo!\n\t    <em><a id=\"login\">Já é cadastrado?\n\t    </a></em>\n\t    \n\t</div>\n</div>\n```\n\n## Login trigger script\n\nNote that the control renders an HTML code with the welcome message and also a script.\n\nThis script is triggered when the user clicks on the element with ID `\"login\"`, which by default comes with the message \"Já é cadastrado?\" (\"Already registered?\"), and is responsible for taking the user to the login screen.\n\n## Cookie\n\nThe script rendered by the control also creates a cookie responsible for informing the store that the user is logged in.\n\nOther VTEX services use the same cookie (for example, product reviews), so they don't need to ask the user to sign in again.\n\nSee in the example script above that the method which creates this cookie is `vtexid.setScope()`.\n\nStill following the example above, the cookie created would be the following: `UserGUID=1acde8b8-c134-45ca-bda6-8496f39d6734`"}