2
0

(wp) Add UTM auto forward

This commit is contained in:
Baptiste Arnaud
2023-06-15 17:36:32 +02:00
parent 42234850ed
commit a64e621432
4 changed files with 13 additions and 7 deletions

View File

@ -102,7 +102,10 @@ class Typebot_Public
$bot_initializer = '<script type="module">
import Typebot from "' . $lib_url . '"
Typebot.initStandard({ apiHost: "' . $api_host . '", id: "' . $id . '", typebot: "' . $typebot . '", prefilledVariables: { ...window.typebotWpUser } });</script>';
const urlParams = new URLSearchParams(window.location.search);
const queryParams = Object.fromEntries(urlParams.entries());
Typebot.initStandard({ apiHost: "' . $api_host . '", id: "' . $id . '", typebot: "' . $typebot . '", prefilledVariables: { ...window.typebotWpUser, ...queryParams } });</script>';
return '<typebot-standard id="' . $id . '" style="width: ' . $width . '; height: ' . $height . ';"></typebot-standard>' . $bot_initializer;
}