WordPress: Siv jQuery Qhib Lub Qhov rai LiveChat Los ntawm nyem qhov txuas lossis khawm Siv Elementor

Siv jQuery los qhib lub qhov rais LiveChat Los ntawm nyem qhov txuas lossis khawm Siv Elementor

Ib qho ntawm peb cov neeg siv khoom muaj Elementor, ib qho ntawm cov nplooj ntawv tsim muaj zog tshaj plaws rau WordPress. Peb tau pab lawv ntxuav lawv cov kev lag luam hauv kev lag luam hauv ob peb lub hlis dhau los, txo qis qhov kev hloov kho uas lawv tau ua, thiab tau txais cov kab ke sib txuas lus zoo dua - suav nrog kev txheeb xyuas.

Cov neeg siv khoom muaj LiveChat, qhov kev pabcuam sib tham zoo heev uas muaj kev sib koom ua ke Google Analytics zoo rau txhua kauj ruam ntawm cov txheej txheem sib tham. LiveChat muaj API zoo heev rau kev sib koom ua ke rau hauv koj qhov chaw, suav nrog kev muaj peev xwm qhib lub qhov rais sib tham siv qhov kev tshwm sim onClick hauv ib qho chaw thauj tog rau nkoj. Nov yog qhov zoo li no:

<a href="#" onclick="parent.LC_API.open_chat_window();return false;">Chat Now!</a>

Qhov no yog ib qho yooj yim yog tias koj muaj peev xwm hloov kho cov cai tseem ceeb lossis ntxiv kev cai HTML. Nrog Elementor, txawm li cas los xij, lub platform raug kaw vim muaj kev ruaj ntseg kom koj tsis tuaj yeem ntxiv ib qho onClick kev tshwm sim rau tej yam khoom. Yog hais tias koj muaj qhov kev cai onClick qhov kev tshwm sim ntxiv rau koj cov cai, koj tsis tau txais ib yam kev ua yuam kev… tab sis koj yuav pom cov code stripped los ntawm cov zis.

Siv jQuery Listener

Ib qho kev txwv ntawm cov txheej txheem onClick yog tias koj yuav tsum tau kho txhua qhov txuas ntawm koj lub xaib thiab ntxiv cov lej ntawd. Lwm txoj hauv kev yog kom suav nrog ib tsab ntawv hauv nplooj ntawv ntawd mloog rau ib qho tshwj xeeb nyem rau ntawm koj nplooj ntawv thiab nws ua tiav cov cai rau koj. Qhov no tuaj yeem ua tiav los ntawm kev nrhiav ib qho twg lossis thauj tog rau nkoj nrog ib qho chav kawm CSS. Hauv qhov no, peb tab tom tsim ib qho chaw thauj tog rau nkoj nrog ib chav kawm npe openchat.

Nyob rau hauv lub footer ntawm lub xaib, kuv tsuas yog ntxiv ib qho kev cai HTML teb nrog cov ntawv tsim nyog:

<script>
document.addEventListener("DOMContentLoaded", function(event) {
  jQuery('.openchat a').click(function(){
    parent.LC_API.open_chat_window();return false;
  });
});
</script>

Tam sim no, cov ntawv ntawd yog qhov chaw dav heev, txawm tias nplooj ntawv twg, yog tias kuv muaj chav kawm openchat uas yog clicked, nws yuav qhib lub qhov rais sib tham. Rau cov khoom Elementor, peb tsuas yog teeb qhov txuas rau # thiab cov chav kawm li openchat.

elementor link

elementor advanced chaw chav kawm

Tau kawg, code tuaj yeem txhim kho lossis siv tau rau lwm hom kev tshwm sim ib yam nkaus, zoo li a Kev tshwm sim Google Analytics. Tau kawg, LiveChat muaj kev koom ua ke zoo nrog Google Analytics uas ntxiv cov xwm txheej no, tab sis kuv suav nrog nws hauv qab no ua piv txwv:

<script>
document.addEventListener("DOMContentLoaded", function(event) {
  jQuery('.openchat a').click(function(){
    parent.LC_API.open_chat_window();return false;
    gtag('event', 'Click', { 'event_category': 'Chat', 'event_action':'Open','event_label':'LiveChat' });
  });
});
</script>

Tsim ib qhov chaw tawm nrog Elementor yog qhov yooj yim heev thiab kuv xav kom lub platform. Muaj ib lub zej zog zoo, tons ntawm cov peev txheej, thiab ob peb Elementor Add-Ons uas txhim kho lub peev xwm.

Pib Nrog Elementor Pib nrog LiveChat

Kev Tshaj Tawm: Kuv tabtom siv cov kev sib txuas rau Elementor thiab LiveChat nyob rau hauv tsab xov xwm no. Qhov chaw uas peb tsim cov kev daws teeb meem yog a Kub Tub Chaw tsim tshuaj paus nyob rau hauv Central Indiana.