Auto-fill the Web Widget Contact Form Follow

Comments

25 comments

  • Avatar
    Miquel Amengual

    Hello,

    Is it possible to auto-fill the custom fields we have created?

    We did it the way explained in this post https://support.zendesk.com/hc/en-us/community/posts/204140386-Filling-In-Custom-Widget-Fields

    However it stopped working recently. Can you offer us an alternative?

    Thank you

  • Avatar
    James Peterson

    Hi Miquel,

    Currently there is no supported method to auto-fill the custom fields. Have you tried contacting the author of that community post? Perhaps he will be able to help as he posted the tip about auto-filling the fields.

    -- James Peterson

  • Avatar
    Amie Barder

    Is there some way to automatically include system specs (browser, browser version, os, os version, etc.) similarly to the Mobile SDK?

  • Avatar
    James Peterson

    Hi Amie,

    You can already see the system specs of the user that submitted the ticket by clicking on the 'show all events' button and scrolling to the first event of the ticket. There you'll see the User Agent String and Browser information.

    Sincerely,
    James Peterson

  • Avatar
    Amie Barder

    My test tickets list multiple browsers under "show all events". Is there any way to know what browser they are using to submit the ticket?

  • Avatar
    James Peterson

    Hi Amie,

    Could you share what you are seeing? If it looks something like this - Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0 - that is the user agent string. You can use a tool like http://www.useragentstring.com/ to analyze any user agent string that you see in Zendesk. Each one will correspond to a specific browser on a specific operating system.

  • Avatar
    Amie Barder

    Yes - that's exactly what I'm seeing. Thanks for the tip, James!

  • Avatar
    Tom H.

    I would love if there was a way to auto-fill a custom field, such as the person's account number. Right now our clients have to fill that in themselves.

  • Avatar
    Tom H.

    Hmm, I tried implementing this in our custom Admin control panel that clients use, where we have the Web Widget installed and working, but, it doesn't work. I put it between <script></script> tags below the web widget code, but, that just makes the whole Web Widget stop working. I have the client's username and email address stored in session variables (it's a PHP site), how can I insert this into the web widget form?

  • Avatar
    Jake Bantz

    Hi Tom,

    Do you have any browser console errors when you see this issue? Or can you share the code you have submitted between the <script></script> tags? Be sure you have replaced the HelpCenter.user properties in the variable declarations with your own values for the customer information. Those properties are specific to the Help Center coupled with your Zendesk.

    Hope this helps!

  • Avatar
    Wouter van Gessel

    Hi,

    Short question: Why is this not implemented to the Help Center by default (out-of-the-box)? 

  • Avatar
    Kevin Rocci

    Howdy Zendesk!

    We just flipped the switch on the web widget! Goodbye Feedback tab.

    One question though: is there a way to stop the widget from creating Zendesk users when they are on a page with the widget?

    More detail:

    I had a report using # of End Users. This was great for seeing how many unique users sent in a ticket in a month period.

    But when we switched over to the web widget this metric isn't useful anymore. Every time a user lands on a page with the web widget, they are added to Zendesk as a user if they don't have an account. (Note: we auto-populate user name and email since they are signed in when they see the widget).

    I'd love to not have the widget create a new user just because they've seen the web widget. I'd rather a new user get created when they send in a ticket. 

    Any help with this would be greatly appreciated. :D

    Thanks! 

  • Avatar
    James Peterson

    Hi Kevin,

    At the moment it's not possible to prevent the Widget from creating users automatically when they visit a page with the widget, however, you should be able to filter your report to exclude users who had not submitted a ticket.  For example, the below metric should give you the number of end-users who have submitted a ticket -

    SELECT COUNT(User, Ticket Id) WHERE User Role = End-user

  • Avatar
    Kevin Rocci

    Hi James!

    Thanks for the tip! That's perfect! :D

    I've been in a back and forth with Zendesk support and no one has yet suggested that solution! And this was exactly what I was asking about. :D

    Thanks again! :D

  • Avatar
    Pankaj Pandey

    Any updates to prefill out custom fields?

  • Avatar
    Thomas D'Hoe

    Hi

    Unfortunately this is'nt working in my helpcenter.

    Can somebody show  me where I must set up the code.

    See screenshot

  • Avatar
    James Peterson (Edited )

     Hi Thomas,

    It looks like you've included the script within a comment block (code in between /* and */ will not be executed).  You should do like this starting on line 29 -

    /*]]>*/
    zE( function () {
    var userName = HelpCenter.user.name;
    var userEmail = HelpCenter.user.email;
    zE.identify({name: userName, email: userEmail});
    });</script>

  • Avatar
    Thomas D'Hoe

    Hi James

    The widget is gone now and not visible anymore... 

  • Avatar
    Jake Bantz

    Hi Thomas,

    It looked like the codes got mixed together a bit, so I figured I'd just give you the block that works on my account. You will want to replace "[YOUR SUBDOMAIN]" with your own, but this should work:

    <!-- Start of Zendesk Widget script -->
    <script>/*<![CDATA[*/window.zEmbed||function(e,t){var n,o,d,i,s,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),i=r.contentWindow,s=i.document;try{o=s}catch(c){n=document.domain,r.src='javascript:var d=document.open();d.domain="'+n+'";void(0);',o=s}o.open()._l=function(){var o=this.createElement("script");n&&(this.domain=n),o.id="js-iframe-async",o.src=e,this.t=+new Date,this.zendeskHost=t,this.zEQueue=a,this.body.appendChild(o)},o.write('<body onload="document._l();">'),o.close()}("https://assets.zendesk.com/embeddable_framework/main.js","[YOUR SUBDOMAIN].zendesk.com");/*]]>*/

    zE( function () {
    var userName = HelpCenter.user.name;
    var userEmail = HelpCenter.user.email;
    zE.identify({name: userName, email: userEmail});
    });
    </script>
    <!-- End of Zendesk Widget script -->

    Hope this helps!

  • Avatar
    Yevhenii Koliesnik (Edited )

    Hi Jake ,
    Can I initialize "description" field like this:

    zE( function () { 
    var userName = HelpCenter.user.name;
    var userEmail = HelpCenter.user.email;
    var customDescription = HelpCenter.user.description;
    zE.identify({name: userName, email: userEmail,
    description: customDescription });
    });
  • Avatar
    Jake Bantz

    Hello Yevhenii,

    The Web Widget API only allows for the name, email, and organization of a user to be set. At this time there is not the ability to set the description. You can have a look at our full Web Widget API documentation here.

    Hope this helps!

  • Avatar
    michael berezin

    we are using the web widget in our company's web site, but the auto-fill feature only works after i clear the browser cache.

     
    i am using this code :
    Snippet

    zenDeskWidget(function () {
                    zenDeskWidget.identify({ name: userName, email: email, externalId: userId });
                });

     

     

  • Avatar
    Mark Hinson

    hi,

    Has anyone used the Autofill the ticket contact details function that Matthew has offered here when the chat widget is implemented in SharePoint, so it captures the name and email of the authenticated SharePoint user?

    thanks, Mark

  • Avatar
    Attila Zsámboki

    Hi there,

    Is there someone who could help me in using this autofill feature in Wordpress? 

    Thanks Attila

  • Avatar
    Nicole Relyea

    Hey Attila - 

    I see that you got your answer in a ticket. In case anyone else has the same question, here's the answer: 

    "In the article you referenced the user data was being pulled in through the help center, which has an object that passes that user's Zendesk information to the widget. If you are using some sort of sign-in system for your customers in Wordpress you could use the Web Widget API along with Javascript to pass the signed-in user's data into the widget in a similar way. That being said, there is no pre-built functionality to do this, so you would need to develop and implement the custom scripting on your end using our API. "

Please sign in to leave a comment.

Powered by Zendesk