WordPress: Amfani da jQuery Don Buɗe Tagar LiveChat Ta Danna Hanya ko Maɓalli ta Amfani da Elementor

Yin amfani da jQuery don buɗe taga LiveChat Ta danna hanyar haɗi ko Maɓalli ta Amfani da Elementor

Ɗaya daga cikin abokan cinikinmu yana da Elementor, ɗaya daga cikin mafi ƙarfi dandali na ginin shafi don WordPress. Mun kasance muna taimaka musu don tsaftace ƙoƙarinsu na tallace-tallace a cikin ƴan watannin da suka gabata, rage gyare-gyaren da suka aiwatar, da samun tsarin sadarwa mafi kyau - gami da nazari.

Abokin ciniki yana da LiveChat, sabis ɗin taɗi mai ban sha'awa wanda ke da ingantaccen haɗin gwiwar Google Analytics don kowane mataki na tsarin taɗi. LiveChat yana da API mai kyau don haɗa shi cikin rukunin yanar gizonku, gami da samun damar buɗe taga taɗi ta amfani da taron onClick a cikin alamar anga. Ga yadda hakan ya kasance:

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

Wannan yana da amfani idan kuna da ikon gyara lambar asali ko ƙara HTML na al'ada. Tare da Elementor, ko da yake, dandamali yana kulle don dalilai na tsaro don kada ku iya ƙarawa Danna taron ga kowane abu. Idan kana da wannan al'ada onClick taron da aka ƙara zuwa lambar ku, ba za ku sami kowane nau'in kuskure ba… amma za ku ga lambar ta cire daga fitarwa.

Amfani da jQuery Listener

Ɗayan iyakancewar hanyar onClick shine cewa dole ne ku gyara kowane hanyar haɗin yanar gizon ku kuma ƙara waccan lambar. Wata hanya ta dabam ita ce haɗa rubutun a cikin shafin wanda saurare don danna takamaiman shafin ku kuma yana aiwatar muku da lambar. Ana iya yin hakan ta hanyar neman kowane alamar anga tare da takamaiman Babban darajar CSS. A wannan yanayin, muna zana alamar anga tare da aji mai suna budechat.

A cikin gindin rukunin yanar gizon, Ina ƙara filin HTML na al'ada tare da rubutun da ya dace:

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

Yanzu, wannan rubutun yana da faɗin rukunin yanar gizon don haka ba tare da la'akari da shafin ba, idan ina da aji budechat da aka danna, zai bude taga chat. Ga abin Elementor, kawai mun saita hanyar haɗi zuwa # da ajin azaman budechat.

mahada elementor

elementor Advanced settings classes

Tabbas, ana iya haɓaka lambar ko ana iya amfani da ita don kowane nau'in taron kuma, kamar a Taron Google Analytics. Tabbas, LiveChat yana da babban haɗin gwiwa tare da Google Analytics wanda ke ƙara waɗannan abubuwan, amma ina haɗa shi a ƙasa kamar misali:

<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>

Gina rukunin yanar gizo tare da Elementor abu ne mai sauƙi kuma ina ba da shawarar dandamali sosai. Akwai babban al'umma, tarin albarkatu, da ƴan ƙaramar Elementor waɗanda ke haɓaka iyawa.

Fara da Elementor Fara Da LiveChat

Bayyanawa: Ina amfani da hanyoyin haɗin gwiwa don Elementor da kuma LiveChat a cikin wannan labarin. Shafin da muka samar da mafita shine a Mai kera Hot Tub a tsakiyar Indiana.