Hello, community!
I am trying to integrate Typebot into my WordPress site and facing an issue related to passing UTM variables.
What I am trying to achieve:
I want to initialize Typebot directly in my HTML code, passing UTM variables that are necessary to enable the bot's functionality.
The apiHost needs to be just the domain (
https://bot.domain.com) and should not include the full URL with parameters.
Example of the code I am using:
html
Copiar código
<script type="module">
import Typebot from '
https://cdn.jsdelivr.net/npm/@typebot.io/[email protected]/dist/web.js';
// Defining UTM variables directly in the code
let utm_email = 'acelmec@gmail.com';
let utm_empresa = 'AM Insurance';
let utm_telefone = '5551999999999';
// Initializing Typebot
Typebot.initBubble({
typebot: "consorcios",
apiHost: "
https://bot.domain.com",
previewMessage: {
message: "Can we help you?",
autoShowDelay: 10000,
avatarUrl: utm_url_banner,
},
theme: {
button: { backgroundColor: "#0042DA" },
chatWindow: { backgroundColor: "#fff" },
},
// UTM variables
variables: {
utm_assinatura: utm_assinatura,
utm_email: utm_email,
utm_empresa: utm_empresa,
utm_telefone: utm_telefone,
utm_url_banner: utm_url_banner
}
});
</script>
The problem:
When I initialize Typebot, it is not recognizing the UTM variables that I am trying to pass, and the bot does not function correctly.
Questions:
How can I ensure that these variables are passed correctly to Typebot?
Is there any additional configuration that I should consider for Typebot to work as expected?
I appreciate any help you can offer!