Where To Add Facebook Messenger Code Snippet

On our website,

Where to add facebook messenger code snippet

Thanks

Sent from my LND-L29 using Tapatalk

What does their instruction say?

Did you manage to add the code snippet? The instructions received are:

Simply paste the code snippet below into your website code. We recommend placing the code after the opening tag on pages where you want the plugin to appear

You should use the index:body hook in this case

Thank you eCom. I am not sure I understand what you mean though. Can you please be a bit more analytical?

Enable the my_changes addon.
Add the file design/themes/responsive/templates/addons/my_changes/hooks/index/body.post.tpl
with the following content:


Then clear your cache and “inspect” the page to verify that your script code is on your page(s).

But given that cs-cart will move all your script code past the footer, there’s no reason to use the ‘index:body’ hook. You can just as easily use ‘index:scripts’ which would be more consistent with integrating other scripts into your site. But both will work. It’s developer’s choice.

If the messenger code inserts html into the UI in a specific location, then you’ll need to add the attribute ‘data=“no_defer”’ to the script tag and then you should use the ‘index:body’ hook. The script tag would then look like:


That will prevent cs-cart from moving the script to the bottom of the page and leave it where you’ve placed it.

Just small correction. Use the following code to leave your code right after the body tag


Thx for the correction Ecom. Was working from memory (not always the best) and use the data-no-defer very infrequently (like maybe once in the 5 years it's been around!).

From the left sidebar, click Settings and choose Insert Headers and Footers. Finally, paste the Messenger chat code into your script header and click Save.

From the left sidebar, click here Settings and choose Insert Headers and Footers. Finally, paste the Messenger chat code into your script header and click Save.

Any update???

Enable the my_changes addon.
Add the file design/themes/responsive/templates/addons/my_changes/hooks/index/body.post.tpl
with the following content:


Then clear your cache and "inspect" the page to verify that your script code is on your page(s).

But given that cs-cart will move all your script code past the footer, there's no reason to use the 'index:body' hook. You can just as easily use 'index:scripts' which would be more consistent with integrating other scripts into your site. But both will work. It's developer's choice.

If the messenger code inserts html into the UI in a specific location, then you'll need to add the attribute 'data="no_defer"' to the script tag and then you should use the 'index:body' hook. The script tag would then look like:


That will prevent cs-cart from moving the script to the bottom of the page and leave it where you've placed it.

Thank you. Just one problem... design/themes/responsive/templates/addons/my_changes does not exist. I have enabled the addon but still... Help please :)

You need to create the path/file.

But given we have no idea what you're installing, can't advise where to use the data-no-defer attribute or not.

Suggest you read the development documentation if you're going to play developer.... https://docs.cs-cart.com/latest/developer_guide/index.html

Thank you. Just one problem... design/themes/responsive/templates/addons/my_changes does not exist. I have enabled the addon but still... Help please :)

@tbirnseth is right. You should create path and file

From the left sidebar, click Settings and choose Insert Headers and Footers. Finally, paste the Messenger chat code into your script header and click Save.

From the left sidebar, click Settings and choose Insert Headers and Footers. Finally, paste the Messenger chat code into your script header and click Save.

Which sidebar are you referring to?