Events Summary
This section summarizes the events exposed by the Client SDK library.
Important
When using the Global-e Module platform, make sure to incorporate the following line prior to registering for the events detailed in this section. Note that the correct queue name for event registration is "glegem
" (and not "gle
").
var glegem = window["glegem"] || function(){(window["glegem"].q = window["glegem"].q || []).push(arguments)};
OnBeforeWelcome
This event occurs before the Welcome pop-up is displayed.
/*event data*/ //e.country = e.g. IL, GB,US //e.culture = e.g. RU,EN //e.currency = e.g. EUR,USD //e.onComplete = argument array of key,value e.g. [{key : 'templateDivId', value : '<b>some html</b>'}] gle("OnBeforeWelcome",function(e){ var html = ""; switch(e.country){ case "NL": html = "<div style='height:20px;text-align:center;font-size:24px;'>Dynamic Content - Holand</div>"; break; case "US": case "GB": html = "<div style='height:20px;text-align:center;font-size:24px;'>Dynamic Content - US & GB</div>"; break; } e.onComplete([{key : "clientDynamicContent", value : html}]); });
OnWelcomeShown
The OnWelcomeShown
event is fired when the welcome pop-up is shown to the customer.
gle("OnWelcomeShown", function(){ //Welcome popup Shown; })
See ???.
OnChangeShippingCountryClicked
The OnChangeShippingCountryClicked
event is fired when the "change shipping country" link on the welcome pop-up is clicked.
gle("OnChangeShippingCountryClicked",function(){ //change shipping country click on welcome popup clicked });
For more information.
OnBeforeSwitcher
The OnBeforeSwitcher
event is fired before the country and currency pop-up is shown.
/*event data*/ //e.country = e.g. IL, GB,US //e.culture = e.g RU,EN //e.currency = e.g. EUR,USD //e.onComplete = argument array of key,value e.g. [{key : 'templateDivId', value : '<b>some html</b>'}] gle("OnBeforeSwitcher",function(e){ var html = ""; if (e.culture == "RU"){ html = "<div style='height:50px;text-align:center;font-size:24px;'>Dynamic Switcher Content - Rusky</div>"; } else{ html = "<div style='height:50px;text-align:center;font-size:24px;'>Dynamic Switcher Content - Other</div>"; } e.onComplete([{key : "clientSwitcherDynamicContent", value : html}]); });
For more information, see ???.
OnWelcomePopupClosed
The OnWelcomePopupClosed
event is fired after the welcome pop-up is closed.
gle("OnWelcomePopupClosed", function(result){ });
For more information, see ???.
OnShippingSwitcherClosed
The OnShippingSwitcherClosed
event is fired after the country and currency pop-up is closed.
gle("OnShippingSwitcherClosed", function(result){ return false; });
For more information, see ???.
OnCheckoutStepLoaded
The OnCheckoutStepLoaded
event is fired twice when the checkout is first loaded. then when it is complete.
gle("OnCheckoutStepLoaded",function(data){ switch(data.StepId){ case data.Steps.LOADED: case data.Steps.CONFIRMATION: if (data.IsSuccess){ //data.OrderId //window.location = "http://www.yourconfirmationpage.com"; } break; } });
OnClientEvent
The OnClientEvent
is fired when the customer interacts with the checkout.
gle("OnClientEvent",function(source,data){ switch(source){ //events } });
For more information, see Client Behaviour Data Collection
QuerySessionValidity
The QuerySessionValidity
event is used to cause the checkout session to expire after a specified amount of time.
gle("QuerySessionValidity",function(oncomplete){ oncomplete( {valid : true,expSeconds :7200}); });
Note:
If this feature is not implemented, the checkout will stay open indefinitely until the shopper clicks the place order button.
Once the timer expires, a pop-up will redirect the customer back to the cart page.