1

I am trying to add tawk.to chat widget to my django site. I used the Django-tawkto package from https://pypi.org/project/django-tawkto/. But still, it's not showing the widget on the page. Here is the output of my page: My Django template for where I want to use tawk.to chat widget

I did check the page source and I can see the tawk.to script over there. But it's not working. I don't know why?

page source for above Django template

Please help me out here. Thanks in Advance.

4 Answers4

1

The problem was not with the code. It's because I was running it on the local machine. Tawk.to Script doesn't work on the local machine. It works fine when you upload it on the server.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
0

I talked with the tawk.to support agent and he gave me a solution.

Add the below meta tag and then place the Django tawk.to tag in the head section. Both tags should be inside the head section.

<meta name="referrer" content="no-referrer-when-downgrade">
{% tawkto_script %}

if the above code doesn't work, replace the tag with the following. use your correct widget id.

{% tawkto_script widget_id='somewidgetid' %}
Praveen Kumar
  • 849
  • 8
  • 8
0

For me, the solution was to add:

SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin"

To settings.py.

You should read the docs for this setting carefully to decide whether it's an acceptable security change for your site.

Cory
  • 22,772
  • 19
  • 94
  • 91
0

For those using the tawk to script without installing any packages:

Just add the meta tag inside the <head> </head>:

<meta name="referrer" content="no-referrer-when-downgrade">

and paste the tawk.to script before the </body> tag.

This works smooth.