Discuz! Board

 找回密碼
 立即註冊
搜索
熱搜: 活動 交友 discuz
查看: 6|回復: 0

WordPress: Open a LiveChat window by clicking a link or button using Elementor

[複製鏈接]

2

主題

2

帖子

8

積分

新手上路

Rank: 1

積分
8
發表於 2024-4-19 00:49:58 | 顯示全部樓層 |閱讀模式
One of our clients uses Elementor as a WordPress site builder. Over the past few months, we've helped them clean up their inbound marketing efforts, minimize the adjustments they've implemented, and improve systems communication—including analytics.

The customer has LiveChat, a fantastic chat service with robust Finland Phone Number Database Google Analytics integration for every step of the chat process. LiveChat has a very good API to integrate into your website, including the ability to open a chat window using the onClick event in the anchor tag.

This is what it looks like:

This is useful if you can modify the underlying code or add your own HTML. However, with Elementor, the platform is locked down for security reasons, so you can't add an onClick event to any object. If you add this custom onClick event to your code, no error type will appear, but the code will be removed from the output.

Using a Click Listener on a class
One of the limitations of the onClick methodology is that you would have to edit every single link on your site to add this code. An alternative methodology is to include a script on the page that listens for a specific click on your page and runs the code for you. This can be done by searching for any anchor tag with a specific CSS class. In this case, we mark the anchor tag with a class called openchat.

We don't want our button to show until Livechat loads, so we'll add a class to our theme that will initially hide any button with this class:

Elementor class
For any Elementor object we want to open chat, we just need to set the class as openchat.

elementor link
elementor advanced settings classes
JavaScript for Livechat to open OnClick
Now we can either add a script to our footer or Google Tag Manager to load LiveChat, show the buttons after loading, and then open the chat window if any element with the openchat class is clicked.

回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

Archiver|手機版|自動贊助|GameHost抗攻擊論壇

GMT+8, 2024-5-2 15:11 , Processed in 0.415754 second(s), 18 queries .

抗攻擊 by GameHost X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回復 返回頂部 返回列表
一粒米 | 中興米 | 論壇美工 | 設計 抗ddos | 天堂私服 | ddos | ddos | 防ddos | 防禦ddos | 防ddos主機 | 天堂美工 | 設計 防ddos主機 | 抗ddos主機 | 抗ddos | 抗ddos主機 | 抗攻擊論壇 | 天堂自動贊助 | 免費論壇 | 天堂私服 | 天堂123 | 台南清潔 | 天堂 | 天堂私服 | 免費論壇申請 | 抗ddos | 虛擬主機 | 實體主機 | vps | 網域註冊 | 抗攻擊遊戲主機 | ddos |