Skip to content

Instantly share code, notes, and snippets.

window.usabilla_live("setEventCallback", function(category, action, label, value) {
var newURL = window.location.protocol + "//" + window.location.hostname;
var type = null;
switch (action) {
case "Feedback:Open":
type = "feedback";
history.replaceState(null, null, newURL);
window.usabilla_live("setEventCallback", function(category, action, label, value) {
if(action != "Feedback:Open") {
return;
}
function sendReplacement(vData) {
console.log(vData);
var data = JSON.parse(vData);
data.url = data.url.replace(new RegExp("##"), "#"); //Define which sections you want to mask or encode here.
console.log(data);
@keshcreations
keshcreations / encode_url_invalid_characters.txt
Created May 16, 2018 08:57
JavaScript for encoding URL with invalid characters
//setEventCallback That on campaign open or feedback open will retrieve the URL en encode it to make sure that non-encoded characters cause issues for using Usabilla.
window.usabilla_live("setEventCallback", function(category, action, label, value) {
var type = null;
var uri = "";
var res = "";
switch (action) {
case "Feedback:Open":
<!-- Usabilla Combicode for Pierce Ecom.-->
<!-- Begin Usabilla for Websites embed code -->
<script type="text/javascript">/*{literal}<![CDATA[*/window.lightningjs||function(c){function g(b,d){d&&(d+=(/\?/.test(d)?"&":"?")+"lv=1");c[b]||function(){var i=window,h=document,j=b,g=h.location.protocol,l="load",k=0;(function(){function b(){a.P(l);a.w=1;c[j]("_load")}c[j]=function(){function m(){m.id=e;return c[j].apply(m,arguments)}var b,e=++k;b=this&&this!=i?this.id||0:0;(a.s=a.s||[]).push([e,b,arguments]);m.then=function(b,c,h){var d=a.fh[e]=a.fh[e]||[],j=a.eh[e]=a.eh[e]||[],f=a.ph[e]=a.ph[e]||[];b&&d.push(b);c&&j.push(c);h&&f.push(h);return m};return m};var a=c[j]._={};a.fh={};a.eh={};a.ph={};a.l=d?d.replace(/^\/\//,(g=="https:"?g:"http:")+"//"):d;a.p={0:+new Date};a.P=function(b){a.p[b]=new Date-a.p[0]};a.w&&b();i.addEventListener?i.addEventListener(l,b,!1):i.attachEvent("on"+l,b);var q=function(){function b(){return["<head></head><",c,' onload="var d=',n,";d.getElementsByTagName('head')[0].",d,"(d.",g,"('scrip
<!-- Usabilla Combicode for Pierce Ecom-->
<!-- Begin Usabilla for Websites embed code -->
<script type="text/javascript">/*{literal}<![CDATA[*/window.lightningjs||function(c){function g(b,d){d&&(d+=(/\?/.test(d)?"&":"?")+"lv=1");c[b]||function(){var i=window,h=document,j=b,g=h.location.protocol,l="load",k=0;(function(){function b(){a.P(l);a.w=1;c[j]("_load")}c[j]=function(){function m(){m.id=e;return c[j].apply(m,arguments)}var b,e=++k;b=this&&this!=i?this.id||0:0;(a.s=a.s||[]).push([e,b,arguments]);m.then=function(b,c,h){var d=a.fh[e]=a.fh[e]||[],j=a.eh[e]=a.eh[e]||[],f=a.ph[e]=a.ph[e]||[];b&&d.push(b);c&&j.push(c);h&&f.push(h);return m};return m};var a=c[j]._={};a.fh={};a.eh={};a.ph={};a.l=d?d.replace(/^\/\//,(g=="https:"?g:"http:")+"//"):d;a.p={0:+new Date};a.P=function(b){a.p[b]=new Date-a.p[0]};a.w&&b();i.addEventListener?i.addEventListener(l,b,!1):i.attachEvent("on"+l,b);var q=function(){function b(){return["<head></head><",c,' onload="var d=',n,";d.getElementsByTagName('head')[0].",d,"(d.",g,"('script
<!-- Usabilla Combicode for Pierce Ecom.-->
<!-- Begin Usabilla for Websites embed code -->
<script type="text/javascript">/*{literal}<![CDATA[*/window.lightningjs||function(c){function g(b,d){d&&(d+=(/\?/.test(d)?"&":"?")+"lv=1");c[b]||function(){var i=window,h=document,j=b,g=h.location.protocol,l="load",k=0;(function(){function b(){a.P(l);a.w=1;c[j]("_load")}c[j]=function(){function m(){m.id=e;return c[j].apply(m,arguments)}var b,e=++k;b=this&&this!=i?this.id||0:0;(a.s=a.s||[]).push([e,b,arguments]);m.then=function(b,c,h){var d=a.fh[e]=a.fh[e]||[],j=a.eh[e]=a.eh[e]||[],f=a.ph[e]=a.ph[e]||[];b&&d.push(b);c&&j.push(c);h&&f.push(h);return m};return m};var a=c[j]._={};a.fh={};a.eh={};a.ph={};a.l=d?d.replace(/^\/\//,(g=="https:"?g:"http:")+"//"):d;a.p={0:+new Date};a.P=function(b){a.p[b]=new Date-a.p[0]};a.w&&b();i.addEventListener?i.addEventListener(l,b,!1):i.attachEvent("on"+l,b);var q=function(){function b(){return["<head></head><",c,' onload="var d=',n,";d.getElementsByTagName('head')[0].",d,"(d.",g,"('scrip
(https\:\/\/www\.viking\.de.*\-c\-5802003.*\?q\=)
window.usabilla_live("setEventCallback", function(category, action, label, value) {
var newURL = window.location.protocol + "//" + window.location.hostname;
var type = null;
switch (action) {
case "Campaign:Open":
type = "feedback";
history.replaceState(null, null, newURL);
window.usbl2 = lightningjs.require("usbl2", "//w.usabilla.com/20ccdb2116cb.js?api_name=usbl2");
<a href='https://feedback.usabilla.com/index.html?id=29df1b3fad21&group=1925dfa73e51' style='color:#7266a6'>
<b>Did you find this email of interest to you?</b>
</a>
<table style='border-collapse: collapse; border-spacing: 0px; margin-top: 10px;' cellpadding='0' cellspacing='0'>
<tr>
<td>
<a href='https://feedback.usabilla.com/index.html?id=29df1b3fad21&group=1925dfa73e51&mood=1' style='display: block; width: 35px; height: 30px; max-height: 30px; border: 0px; color:#007CB1;'>
<img src='https://d6tizftlrpuof.cloudfront.net/themes/production/hollandandbarrett-h-b-sept-2017-mood-custom-sprite-url-1-69b3c21daa6f427a75323cfd53f5c6e9.png'
alt='1' border='0' style='display: block; width: 30px; height: 30px;'> </a>
</td>