tawk-drupal's Issues
Failed to set Visitors name and mail from Drupal module
I'm using the module in a development site, the widget is loading nicely and it's using the remote configurations I set on my dashboard. Now I'm trying to set the name and email by default when the user access the site but so far I'm out of luck.
Here's the code I'm using:
### global `$user;
$user = user_load($user->uid);
$name = (int) $user->uid > 0 ? $user->field_first_name['und'][0]['value'] .' '. $user>field_last_name['und'][0]['value'] : $user->name;
$email = (int) $user->uid > 0 ? $user->mail : '';
return t('<!--Start of Tawk.to Script-->
<script type="text/javascript">
var Tawk_API = Tawk_API || {}, Tawk_LoadStart = new Date();
(function(){
var s1 = document.createElement("script"), s0 = document.getElementsByTagName("script")[0];
s1.async = true;
s1.src = "https://embed.tawk.to/@p/@w";
s1.charset = "UTF-8";
s1.setAttribute("crossorigin","*");
s0.parentNode.insertBefore(s1,s0);
})();
Tawk_API.onLoad = function() {
Tawk_API.visitor = {
name : \'@n\',
email : \'@m\'
};
console.log("@m");
};
</script><!--End of Tawk.to Script-->', array('@p' => $page_id, '@w' => $widget_id, '@m' => $email, '@n' => $name));
(BTW I'm using the t function which I believe makes sense because it's cleaner code)
The events are loading correctly and the variable is set with the correct data but the widget never get's the name, it always ask me to set it manually. Am I doing something wrong here?
Is there any version for drupal8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.