Archived topic
Facebook Messenger
5 replies · Started by David on March 17, 2020
Hello, i want to put Facebook Messenger un my website and Facebook send me a Code to put on muy web. They told me that i must to put on the body of the Pagés where i want yo use It. can i put this Code/script using a hook? If you think what i can do it... What hook i must to use? And can i use a hook for using Facebook Messenger with all the pages in mi website. Thanks a lot for your help in advance.
This is the Facebook Messenger Code:
<!-- Load Facebook SDK for JavaScript -->
<script>
window.fbAsyncInit = function() {
FB.init({
xfbml : true,
version : 'v6.0'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_GB/sdk/xfbml.customerchat.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Your customer chat code -->
<div class="fb-customerchat"
attribution=install_email
page_id="534723616958263"
theme_color="#20cef5"
logged_in_greeting="Hi! How can we help you?"
logged_out_greeting="Hi! How can we help you?">
Hi there,
I believe the javascript code should go in the wp_footer hook:
https://docs.generatepress.com/article/hooks-element-overview/
Then the <div> would go wherever you'd like the chat to appear:
https://docs.generatepress.com/article/hooks-visual-guide/
Thanks for the quick reply.
Using gp hooks, I have put the complete code in one of the websites where you have told me; wp_footer and it has worked perfectly.
However, on the other website I have, which is almost a clone of this one but with another domain name and very similar, same plugins... etc, it doesn't work and facebook says that plugin must run with the two sites:
"facebokk says"
1. Confirm your website domain name appears
The website domains listed below are able to display the customer chat plugin for EPM Pools & Construction. Ask Jack Cosson if you don't see the website listed.
https://epm-construction.com/en/home/, https://epmpools.com/en/home/
2. Install the plugin
Simply paste the code snippet below into your website code. We recommend placing the code after the opening <body> tag on pages where you want the plugin to appear.
and the code explained above.....
any ideas?
Thanks a lot in advance again
Hi there,
The first message sounds like you haven't confirmed ownership of the website. Have you taken all of the necessary steps with this second website?
If they want the open after the opening <body> element, you should choose the wp_body_open hook.
Thanks for your reply. Something wrong with Facebook adding the second site. You reír Tom. Thanks a lot
No problem!