Jump to content

danialbulloch

Members
  • Posts

    90
  • Joined

  • Last visited

  • Days Won

    16

Posts posted by danialbulloch

  1. We have a couple of clients with employees that don't have company emails. For those clients, the ticket is assigned to the primary contact, instead of the user. Which means that we can't get Smileback feedback from the end user, only the primary contact. For those clients I made the follow widget which can be embedded on a webpage to give feed back. Just drop your smileback survey code into the "emailcode" variable and put it on your website. Usage: https://url?ticketnumber. E.G. https://fake.com/feedback/?123456.

    <div id="survey"></div>
    <script>
    var emailcode = `
    Replace This with your survey snippet!
    `
    var badticketnumber = `
    Sorry, the ticket number provided is incorrect.
    `
    //edit the next two variables with a reasonable range for your tickets. 
    var ticketidmax = 9999999
    var ticketidmin = 99999
    
    //this grabs everything after the ? on a url, and converts it to a number. Doesn't need to be edited.
    var ticketid =  parseInt(window.location.search.substr(1))
    
    //this makes sure the result of the after ? is a number, and is in the acceptable range.
    if (typeof ticketid === "number" && ticketid > ticketidmin && ticketid < ticketidmax) {
    	var surveydiv = document.getElementById('survey')
        //this replaces the [srnumber] tags with the actual ticket number
    	surveydiv.innerHTML = emailcode.replace(/\[srnumber]/g,ticketid)
    } else {
      	//this will display an error message if a ticket number isn't right(ish)
    	var surveydiv = document.getElementById('survey')
    	surveydiv.innerHTML = badticketnumber
    }
    
    </script>

     

    • Thanks 1
×
×
  • Create New...