GithubHelp home page GithubHelp logo

tawk-drupal's People

Contributors

alvinjohnsonso avatar pyhrus avatar robdas avatar tawk-devj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.