Page 1 of 1

Something odd happening with script

Posted: Sun Sep 18, 2022 3:22 am
by thisazlife
removed

On the index.html page I have added Facebook chat plugin. If I put the plug in on a different website it works perfectly but not on this website, it appears to terminate. Additionally I see schema.org info that I can't find anywhere on this site. I'd appreciate any assistance you will provide.
Thanks!

Re: Something odd happening with script

Posted: Sun Sep 18, 2022 6:35 am
by Pablo
Your page is using layout grids so if you add the script at the end of the body then it will may not be visible because it's not part of the layout structure of the page.
You will need to insert the code inside an HTML object and place it in a layout grid.

Note that I cannot assist you with custom or third party code, because every script is different and for me it may also take a lot of time to figure out how to use the code correctly.
If you want to insert custom code then it is assumed that you know what you are doing.
However, the code will be inserted "AS IS", so if it does not work then either the code is not correct or it conflicts with other code on the page.

Re: Something odd happening with script

Posted: Sun Sep 18, 2022 10:45 pm
by thisazlife
Thanks, I tried to put the code in the html object and placing it in my first grid then re-publishing but it still didn't work. I understand you can't troubleshoot 3rd party scripts so I appreciate your time you already spent.

Did you notice the schema.org info in the index.html page? I can't find any object on that page that contains schema.org info and there isn't a custom json file in the documents\wysiwyg...\system folder either... I can't figure out where that data is coming from as I'd like to change it. I tried adding the schema.org object but then there are 2 references to schema.org in the published code. Any ideas?

Re: Something odd happening with script

Posted: Mon Sep 19, 2022 5:46 am
by Pablo
If the code is correct then it should work when published.
Did you notice the schema.org info in the index.html page?
The object ID is: StructuredData1
You can find it via the Object Manager

Re: Something odd happening with script

Posted: Mon Sep 19, 2022 6:33 pm
by thisazlife
Nope, there's no StructuredData1 object.

Re: Something odd happening with script

Posted: Mon Sep 19, 2022 6:46 pm
by thisazlife
Using WB16 I create a new page, enter the Facebook chat plugin between body tags, publish, plug in installs and works great!
Using WB17 I create a new page, enter the Facebook chat plugin between body tags, publish, plug in fails.

<!-- Messenger Chat Plugin Code -->
<div id="fb-root"></div>

<!-- Your Chat Plugin code -->
<div id="fb-customer-chat" class="fb-customerchat">
</div>

<script>
var chatbox = document.getElementById('fb-customer-chat');
chatbox.setAttribute("page_id", "337859316595549");
chatbox.setAttribute("attribution", "biz_inbox");
</script>

<!-- Your SDK code -->
<script>
window.fbAsyncInit = function() {
FB.init({
xfbml : true,
version : 'v15.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_US/sdk/ ... merchat.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>

Re: Something odd happening with script

Posted: Mon Sep 19, 2022 7:55 pm
by Pablo
In the project you have shared there is an object named StructuredData1.
You can find it via the Object Manager.

The script will be inserted "AS IS". There is no difference between WB16 and WB17. Unless you have used different settings.

Re: Something odd happening with script

Posted: Tue Sep 20, 2022 12:06 am
by thisazlife
UPDATE: Thank you for your assistance. I have everything fixed now!

Interestingly the objects named StructuredData1 did not show in the object manager on any of the pages. However if I did a search on "StructuredData1" it did find that object on several pages which I was then able to delete, all were marked "visible" yet they did not show up without searching for them.

On my script issue, In V17 a JavaScript option was checked in my options, "Generate external JS file for page specific scripts". I don't have record that I ever checked that box but was able to track it down as the difference between V16 and V17 options. Once I removed that check, everything published as I was expecting it to.