- Issue created by @akmalfikri
- πΊπ¦Ukraine andriy khomych
It should be possible by using preprocess functions for the
'tawk_to' => [ 'variables' => [ 'items' => [], ], ],
or changing directly in the https://git.drupalcode.org/project/tawk_to/-/blob/3.0.x/templates/tawk-t...
- π²πΎMalaysia akmalfikri
I'm not very good in javascript, but here I go.
I tried to use onBeforeLoad instead :
window.Tawk_API.onBeforeLoad = function(){ $(s1).src = "https://embed.tawk.to/"+ $(propertyid) + "/default"; };
but doesn't seem to work.
- πΊπ¦Ukraine andriy khomych
Well, it isn't PHP,I suggest to create in your theme twig template tawk-to.html.twig and inject it here:
<!--Start of Tawk.to Script--> <script type="text/javascript"> var Tawk_API=Tawk_API||{}; Tawk_API.visitor = { name: "{{ items.user_name }}", email: "{{ items.user_email }}", }; var $_Tawk_LoadStart = new Date(); (function () { var s1 = document.createElement("script"), s0 = document.getElementsByTagName("script")[0]; s1.async = true; {% autoescape false %} s1.src = "{{ items.embed_url }}/{{ items.page_id }}/{{ items.widget_id }}"; {% endautoescape %} s1.charset = "UTF-8"; s1.setAttribute("crossorigin", "*"); s0.parentNode.insertBefore(s1, s0); })(); </script> <!--End of Tawk.to Script-->
and replace, adjust part :
{% autoescape false %} s1.src = "{{ items.embed_url }}/{{ items.page_id }}/{{ items.widget_id }}"; {% endautoescape %}
- π²πΎMalaysia akmalfikri
Thank you @Andriy Khomych! That works!
Now my issue is 404 for some of the properties.
- Status changed to Closed: works as designed
about 1 year ago 6:16am 18 September 2023