WordPress: Ma te whakamahi i te jQuery Hei Whakatuwhera i te Matapihi LiveChat Ma te paatene i te Hononga, i te Patene ranei ma te whakamahi i te Elementor

Ma te whakamahi i te jQuery hei whakatuwhera i te Matapihi LiveChat Ma te Pao i te Hononga, i te Patene ranei ma te Elementor

Kei tetahi o a maatau kaihoko Elementor, tetahi o nga papahanga wharangi tino pakari mo WordPress. Kei te awhina matou i a raatau ki te horoi i a raatau mahi hokohoko i roto i nga marama kua pahure ake nei, me te whakaiti i nga whakaritenga i whakatinanahia e ratou, me te pai ake o te whakawhitiwhiti korero a nga punaha - tae atu ki nga tātaritanga.

Kei te kaihoko LiveChat, he ratonga korerorero tino pai e kaha ana te whakaurunga a Google Analytics mo ia taahiraa o te tukanga korerorero. He tino pai te API a LiveChat mo te whakauru ki to papaanga, tae atu ki te whai waahi ki te whakatuwhera i te matapihi korero korero ma te whakamahi i tetahi kaupapa onClick i roto i te tohu punga. Anei te ahua o tera:

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

He pai tenei ki te whai koe i te kaha ki te whakatika i te waehere matua ki te taapiri HTML ritenga ranei. Me Elementor, ahakoa, kua tutakina te papa mo nga take haumaru kia kore e taea e koe te taapiri i tetahi takahanga onClick ki tetahi mea. Mena kua taapirihia e koe te kaupapa onClick ritenga ki to waehere, kare koe e puta he momo hapa… engari ka kite koe kua tangohia te waehere mai i te putanga.

Ma te whakamahi i te jQuery Listener

Ko tetahi herenga o te tikanga onClick me whakatika e koe nga hononga kotahi ki to papaanga me te taapiri i taua waehere. Ko tetahi atu tikanga ko te whakauru i tetahi tuhinga ki te wharangi whakarongo mo te pawhiri motuhake ki to wharangi ka mahia e ia te waehere mo koe. Ka taea tenei ma te rapu mo tetahi punga punga me te motuhake akomanga CSS. I tenei keehi, kei te tohu tatou i tetahi tohu punga me te karaehe kua whakaingoatia korerorero tuwhera.

I roto i te hiku o te papaanga, ka taapirihia e au he mara HTML ritenga me nga tuhinga e tika ana:

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

Inaianei, kei te waahi whanui tera tuhinga na ahakoa he aha te wharangi, mena he karaehe taku korerorero tuwhera ka paatohia, ka whakatuwherahia te matapihi korerorero. Mo te ahanoa Elementor, ka tautuhi noa matou i te hono ki te # me te akomanga hei korerorero tuwhera.

hononga huānga

nga akomanga tautuhinga matatau

Ko te tikanga, ka taea te whakanui i te waehere, ka taea ranei te whakamahi mo etahi atu momo huihuinga, penei i a Takahanga Tauhokohoko Google. Ae ra, he tino tuitui a LiveChat me Google Analytics e taapiri ana i enei huihuinga, engari kei te whakauruhia e au ki raro hei tauira:

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

Ko te hanga i tetahi papanga me te Elementor he tino ngawari, a ka tino taunaki ahau ki te kaupapa. He hapori nui, he maha nga rauemi, me etahi atu Elementor Add-Ons e whakanui ana i nga kaha.

Tīmatahia me te Elementor Timata Ma te LiveChat

Whakaaturanga: Kei te whakamahi au i nga hononga hono mo Elementor a LiveChat i roto i tenei tuhinga. Ko te waahi i whakawhanakehia e matou te otinga he Kaihanga Hot Tub kei te puku o Indiana.