How to Include end-user browser information via Help Center | Community
Skip to main content

How to Include end-user browser information via Help Center

  • December 7, 2015
  • 51 replies
  • 0 views

Show first post
This topic has been closed for replies.

51 replies

Heather13
  • May 3, 2017

ok :( No we have not switched to Copenhagen yet

Yes it makes the HC look like an old Iphone app.

But it will work on tickets submitted from regular web browsers, correct?


Martijn12
  • Author
  • May 3, 2017

Sure, it will work on all pages where the theme you are using is been showed. The 'iPhone app' look isn't customizeable so this will not work.

I recommend to migrate to a responsive Help Center as more and more visitors are using mobile phones. If you have trouble with making the Help Center layout fit to your brands look and feel we (pluscloud, Zendesk Premier Solution Provider) can help you with this.


  • May 3, 2017

Hello all! 

Does anyone know if it's possible to have this data also write itself into the body of the ticket email?


Martijn12
  • Author
  • May 5, 2017

Hi Dave, this is possible for sure. If would require some more research and testing to see if it can be pushed to the ticket body without showing it to the visitor but it's easy to just push it to the field and allow the visitor to see this.

Replace this:

$('#request_custom_fields_'+ browserfield_id).val(
'OS: ' + jscd.os +' '+ jscd.osVersion + '\n' +
'Browser: ' + jscd.browser +' '+ jscd.browserMajorVersion +
' (' + jscd.browserVersion + ')\n' +
'Mobile: ' + jscd.mobile + '\n' +
'Flash: ' + jscd.flashVersion + '\n' +
'Cookies: ' + jscd.cookies + '\n' +
'Screen Size: ' + jscd.screen + '\n\n' +
'Full User Agent: ' + navigator.userAgent);
$('div.request_custom_fields_' + browserfield_id).css({ display: "none" });

With the following:

$('#request_description').val(
'\n\n----- Browser information -----\nOS: ' + jscd.os +' '+ jscd.osVersion + '\n' +
'Browser: ' + jscd.browser +' '+ jscd.browserMajorVersion +
' (' + jscd.browserVersion + ')\n' +
'Mobile: ' + jscd.mobile + '\n' +
'Flash: ' + jscd.flashVersion + '\n' +
'Cookies: ' + jscd.cookies + '\n' +
'Screen Size: ' + jscd.screen + '\n\n' +
'Full User Agent: ' + navigator.userAgent);

  • May 5, 2017

Hey Martijn, 

As that would technically do what I would need, you hit the nail on the head with needing to hide that lol. I'm sure people would be a little weirded out to see all their info pulled, plus they have the ability to delete it with this. Hmm. I wonder if it could still exist in the hidden custom field, but not write to the side panel, but be pulled into the body after they hit submit. The whole issue is that while we do want this information, we don't want the customer ever knowing we pulled the info.


Martijn12
  • Author
  • May 5, 2017

Hi Dave, if you want to keep it hidden from the requestor it's no option to push it in the Ticket Comments. Later on the email reply the requester would notice this as it's been pasted under his or her message.

Another option would be to use the HTTP Targets to push an internal note to the ticket. This is quite easy if you follow these steps:

  1. Go to your Settings in Zendesk Support
  2. Scroll down and choose Extensions
  3. Click add target and choose HTTP target
  4. Fill in a Title for this action, for an example 'Push Browser Information To Ticket Stream'
  5. At the URL enter the following (and replace {subdomain} with your Zendesk account: https://{subdomain}.zendesk.com/api/v2/tickets/{{ticket.id}}.json
  6. Set Method to PUT and make sure the Content type is been set to JSON.
  7. Switch on the Basic Authentication and enter your Administrator credentials (more information)
  8. Change the dropdown next the the Submit button to Create target and press Submit



  9. Now you need to create a Trigger to actually make something happening. Again go to the Settings and now choose Triggers.
  10. Press Add Trigger
  11. Enter a Title in the top text field, for an example 'Push Browser Information to Ticket Comment'
  12. In the first section under 'Meet all of the following conditions' create the following conditions:
    - Ticket: Is... Created
    - Ticket: Channel Is Web form
  13. The second section 'Meet any of the following conditions' can be left empty
  14. In the third section under 'Perform these actions' you create the following action: 'Notification: Notify target'
  15. Choose the target you've just created and paste the following information in the JSON body field, make sure you replace the 00000000 with the correct custom field ID.
    {
    "ticket": {
    "comment": {
    "body": "{{ticket_field_00000000}}",
    "author_id": {{ticket.requester.id}},
    "public": false
    }
    }
    }


  • October 25, 2017

Hi Martijn,

I have exactly the same issue as Chris had in July 2016.

We are using Copenhagen theme.

I'm following the steps and when I copy/paste the code below the last </div> tag I get a lot of white text and pink highlight.

I suspect that there may be some issue when I'm transferring a script to my Help Centre I was trying to use Google Chrome, IE, online HTML & JAVA editors and even the original version of this script: http://jsfiddle.net/ChristianL/AVyND/

Unfortunately, I wasn't able to resolve this issue...

I'm starting from here (after the last </div>):

First issues are visible here:

And then I have even more:

Any help would be much appreciated!


  • January 3, 2018

Hi Martijn,

I'm following the steps but I'm not sure where can the "New Request template".

Can you please help?

 

Thanks,

Amir


  • January 5, 2018

Hi Amir! 

You can reach your templates through your Guide Admin tools (just click Guide admin from inside your Help Center) provided you're on a high enough plan. Do you know what plan you're on?


  • March 2, 2018

Hi Martijn,

Thank you for this is great article!

I just have a question here as to what part of the code, if it does, extracts the browser when using this via an in-app browser? And what would it typically show under 'browser'?

Thanks,

Saranya

 

 


  • November 21, 2018

Realise this is an old thread but I'm interested to know if it's possible to detect the device the user is on without prompting them for that info. 

Wish list: Device/make and model
Android OS version

Basically all the good stuff Google Play polls when we use that integration.

Cheers!

Matt


  • November 27, 2018

Hey Matt,

To clarify since you mentioned mobile OSs -- are these requests that are via the mobile Help Center access through a browser, or are they requests from a Mobile SDK implementation? The two capture different sets of information.

If you go to the events view of a ticket submitter through a mobile browser, the initial comment will have a user agent string that looks something like this:

  • Mozilla/5.0 (Linux; Android 6.0; LGUS991) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36
  • 107.77.206.22
  • IL, United States

The top bullet point is called a user agent string and can be decoded using a site like http://www.useragentstring.com/ to see what browser they are using. Note that this string does not include the OS version nor the model/make; just the mobile browser info.

Meanwhile if you go to the events view of a ticket submitted via the SDK, you get something like this:

  • Zendesk-SDK/2.0.0 Android/23 Variant/Support
  • 12.345.6.78
  • 12, India

This includes the OS and SDK version, but not the make/model. However, if you hit the ticket audits API endpoint of the ticket, the SDK does capture that data in a "metadata" object. It looks like this:

"custom": {
"sdk": {
"device_used_memory": "825",
"device_manufacturer": "samsung",
"device_os": "6.0.1",
"device_total_memory": "1383",
"device_battery": "100",
"device_name": "j5lte",
"device_model": "SM-J500F/j5lte",
"device_low_memory": "false",
"device_api": "23"
}
}

More about the ticket audits api endpoint here:

  https://developer.zendesk.com/rest_api/docs/support/ticket_audits 


  • November 28, 2018

Hey Andrew, thanks for the reply!

So I meant whether it's possible to gather all that good stuff you highlighted in your SDK example. 
Ideally I want that through the browser help center.

Cheers,

Matt


  • November 29, 2018

Hey Matt,

 

Unfortunately we wouldn't capture that by default. The workaround detailed in this post includes OS data, though. 


  • February 7, 2019

Does this work for the latest version of Zendesk?

I created the custom ticket field, populated it with the browser options and copied in the code directly while changing the browser ID according to the created custom ticket field.

I'm getting the same issue where my code is turning black/red as if it's commented out and there are errors.


  • February 20, 2019

Hi Sajan,

The coloring of the text looks good from what I can see, but I can't see the end of your code  -- are you using the closing script tag? And what are the errors?


  • May 10, 2019

Hi Sajan,

The coloring looks good.

For me, I only got the code to work after removing the quotation mark on the following line: 

// flash (you'll need to include swfobject)

 

 

 


  • August 24, 2019

Is this code available to work with the Help Widget at this point?


Brett13
  • Community Manager
  • August 29, 2019

Hey Michael,

The tickets created through the web widget automatically captures the browser and OS information of the requester. You can find these by clicking on the Conversations option at the upper left corner of the top of the ticket comment and change it to Events. If you scroll down to the bottom of the ticket, you will see a string of browser information there.

Let me know if you experience issues on your end as I'm happy to assist further.

Cheers!


  • August 29, 2019

Brett,

Yes, I'm familiar with the conversations data point, however, in the above code it is writing to a field value as that gives us the ability to record that and also map that to a Jira field when we escalate to Jira.  I would like the same ability that the mobile and laptop/desktop browser experience at the ticket creation level offers with the above code.

Is that something that could be done?

Thanks so much.

- Michael

 


Brett13
  • Community Manager
  • September 3, 2019

Hi Michael,

My knowledge in this area is rather limited so I'm afraid I won't be much help here. Hopefully, others can jump in and offer up some guidance if this is possible.

I'll also reach out to some of our Community Moderators to see if they have any advice to offer.

Cheers!


  • April 16, 2020

Any update on this? It would be great to have a fix if anyone knows how to get this working. Looks like Rudolf's question above was never really answered. And he was having the same problem as Chris in 2016. I'm having the same problem now. I followed the instructions exactly (plus tried removing the first line and the errant apostrophe another poster mentioned), and the end-user information simply isn't captured in my ticket. Thoughts? 


Nicole17
  • April 28, 2020

@Martijn Snels ยท pluscloud.nl - do you have any suggestions? 


Martijn12
  • Author
  • April 28, 2020

@Nicole - Community Manager @Amelia Jaycen We are soon bringing the browser information feature to our Ticket Field Magic app on the Zendesk App Marketplace so you can easily add this feature to your ticket form among with many other cool ticket field tricks. I'll update this community post once the new release is available.


Jim57
  • May 15, 2020

We are using the Copenhagen theme, which apparently does not include JQuery. So I had to modify the bottom part of the script to use vanilla JS:

document.querySelector('#request_custom_fields_' + browserfield_id).value = 
'OS: ' + jscd.os +' '+ jscd.osVersion + '\n' +
'Browser: ' + jscd.browser +' '+ jscd.browserMajorVersion +
' (' + jscd.browserVersion + ')\n' +
'Mobile: ' + jscd.mobile + '\n' +
'Flash: ' + jscd.flashVersion + '\n' +
'Cookies: ' + jscd.cookies + '\n' +
'Screen Size: ' + jscd.screen + '\n\n' +
'Full User Agent: ' + navigator.userAgent;
document.querySelector('.request_custom_fields_' + browserfield_id).hidden = true;

The template looks like it has errors, since the color highlighting is all screwy, but it works. I even left this line as-is, with the apostrophe:

// flash (you'll need to include swfobject)