retreaverjs-rails 0.2.19 → 0.2.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 229b16754a9221f058c61c8c8cf7a96e25a18d1d7ba175edddc0cc38f34642ac
4
- data.tar.gz: 28340cb19bfed6db092bc52c67ffaab24627cc57a6f4547871cb7a930f1a5c3e
3
+ metadata.gz: 711bb28896fe256ad2cbd4dc461a83e8b9f65a47d1e82ad98c743f53fd0e2186
4
+ data.tar.gz: 0107420a0e4a4af80643873bedb0ba435b8eb355b7fa9786fa842d3c1819f756
5
5
  SHA512:
6
- metadata.gz: ecaf1bba18f21f065c3dac669eded17f5c03e0b6a8e7f110ae049ef5f21ba10cb552ea6df0a4ca9f22b1201074be00f1b3dd2723d482ba943ef16e6111bde78d
7
- data.tar.gz: 2ecbd30aef99ef4544625bfefc23ffb8b28aebeed9445a2186f6d90bb0a42db7eb426b6dabbc8ddee5a3c6921d78b18dba532e939aa4dea8b16d93e8f07b14ba
6
+ metadata.gz: f483c5e53d7f7d924f7d24ee77d30ecbbaf10dacf2ece0ac60c075a9038c387b7fc0088929fab92f91da8744c2ac6af304950952dea0086f139c0208325c6a23
7
+ data.tar.gz: e4fef1736560a6f1adc78e8dafa5744423a534e7fd61cd9de0cc74609f0f541e0c8aa9fb46da163b956632f9b3b00db282efdfeffe11e7404a9eaff42146f4d2
@@ -1,5 +1,5 @@
1
1
  module Retreaver
2
2
  module Rails
3
- VERSION = '0.2.19'
3
+ VERSION = '0.2.21'
4
4
  end
5
5
  end
data/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "retreaver",
3
3
  "description": "Retreaver Javascript API",
4
- "version": "0.2.19",
4
+ "version": "0.2.21",
5
5
  "homepage": "https://github.com/retreaver/retreaverjs",
6
6
  "repository": {
7
7
  "type": "git",
@@ -40,15 +40,59 @@
40
40
  }
41
41
  }
42
42
 
43
- function handle_true_call_integration(number) {
43
+ function get_integration_config(number, integration) {
44
44
  const integrations = number.get("integrations");
45
45
 
46
- if (typeof(integrations) != 'object'){
46
+ if (typeof(integrations) != 'object') {
47
+ return;
48
+ }
49
+
50
+ const integrationConfig = integrations[integration];
51
+ if (typeof(integrationConfig) == 'undefined') {
47
52
  return;
48
53
  }
49
54
 
50
- const trueCallConfig = integrations["truecall.com"];
51
- if (typeof(trueCallConfig) == 'undefined') {
55
+ return integrationConfig;
56
+ }
57
+
58
+ function handle_google_analytics_integration(number) {
59
+ googleAnalyticsConfig = get_integration_config(number, "google_analytics");
60
+ if (typeof(googleAnalyticsConfig) == "undefined") {
61
+ return;
62
+ }
63
+
64
+ const obtainGoogleAnalyticsCookies = new Promise(function(resolve) {
65
+ const googleAnalyticsInterval = setInterval(function() {
66
+ const gaSessionIdPattern = /_ga_[^=]+=([^;]*)/;
67
+ const gaSessionMatch = document.cookie.match(gaSessionIdPattern);
68
+ const gaSessionMatched = gaSessionMatch && gaSessionMatch[1];
69
+
70
+ const gaClientIdPattern = /_ga=([^;]*)/;
71
+ const gaClientMatch = document.cookie.match(gaClientIdPattern);
72
+ const gaClientMatched = gaClientMatch && gaClientMatch[1];
73
+
74
+ if (gaSessionMatched && gaClientMatched) {
75
+ resolve({
76
+ gaSessionId: gaSessionMatched,
77
+ gaClientId: gaClientMatched,
78
+ });
79
+
80
+ clearInterval(googleAnalyticsInterval);
81
+ }
82
+ }, googleAnalyticsConfig["checkIntervalMs"]); // Try to get the Google Analytics session data every X milliseconds
83
+ })
84
+
85
+ obtainGoogleAnalyticsCookies.then(function (sessionData) {
86
+ number.replace_tags({
87
+ ga_session_id: sessionData.gaSessionId,
88
+ ga_client_id: sessionData.gaClientId,
89
+ });
90
+ });
91
+ }
92
+
93
+ function handle_true_call_integration(number) {
94
+ trueCallConfig = get_integration_config(number, "truecall.com");
95
+ if (typeof(trueCallConfig) == "undefined") {
52
96
  return;
53
97
  }
54
98
 
@@ -66,20 +110,18 @@
66
110
  })();
67
111
  }
68
112
 
69
- const obtainTrueCallId = new Promise(function(resolve) {
70
- const trueCallInterval = setInterval(function() {
71
- if (window.TrueCall && window.TrueCall.getId()) {
72
- resolve(window.TrueCall.getId())
113
+ const trueCallInterval = setInterval(function() {
114
+ if (window.TrueCall) {
115
+ window.TrueCall.setDID(number.get("number")).then(function() {
73
116
  clearInterval(trueCallInterval);
74
- }
75
- }, trueCallConfig["checkIntervalMs"]); // Try to get the trueCallId every X milliseconds
76
- })
77
-
78
- obtainTrueCallId.then(function (trueCallId) {
79
- const tags = {};
80
- tags[trueCallConfig["tagName"]] = trueCallId;
81
- number.replace_tags(tags);
82
- });
117
+ return window.TrueCall.getIdAsync();
118
+ }).then(function(trueCallId) {
119
+ const tags = {};
120
+ tags[trueCallConfig["tagName"]] = trueCallId;
121
+ number.replace_tags(tags);
122
+ });
123
+ }
124
+ }, trueCallConfig["checkIntervalMs"]);
83
125
  }
84
126
 
85
127
  var self = this;
@@ -138,6 +180,12 @@
138
180
  console.error("Could not integrate with truecall.com, ", e);
139
181
  }
140
182
 
183
+ try {
184
+ handle_google_analytics_integration(number);
185
+ } catch (e) {
186
+ console.error("Could not integrate with google analytics, ", e);
187
+ }
188
+
141
189
  // if there is a replacement in the response, replace all occurrences
142
190
  // of that number on the page with the retreaver number
143
191
  if (typeof(data.number.replacement_numbers) !== 'undefined') {
@@ -1159,15 +1159,59 @@
1159
1159
  }
1160
1160
  }
1161
1161
 
1162
- function handle_true_call_integration(number) {
1162
+ function get_integration_config(number, integration) {
1163
1163
  const integrations = number.get("integrations");
1164
1164
 
1165
- if (typeof(integrations) != 'object'){
1165
+ if (typeof(integrations) != 'object') {
1166
+ return;
1167
+ }
1168
+
1169
+ const integrationConfig = integrations[integration];
1170
+ if (typeof(integrationConfig) == 'undefined') {
1166
1171
  return;
1167
1172
  }
1168
1173
 
1169
- const trueCallConfig = integrations["truecall.com"];
1170
- if (typeof(trueCallConfig) == 'undefined') {
1174
+ return integrationConfig;
1175
+ }
1176
+
1177
+ function handle_google_analytics_integration(number) {
1178
+ googleAnalyticsConfig = get_integration_config(number, "google_analytics");
1179
+ if (typeof(googleAnalyticsConfig) == "undefined") {
1180
+ return;
1181
+ }
1182
+
1183
+ const obtainGoogleAnalyticsCookies = new Promise(function(resolve) {
1184
+ const googleAnalyticsInterval = setInterval(function() {
1185
+ const gaSessionIdPattern = /_ga_[^=]+=([^;]*)/;
1186
+ const gaSessionMatch = document.cookie.match(gaSessionIdPattern);
1187
+ const gaSessionMatched = gaSessionMatch && gaSessionMatch[1];
1188
+
1189
+ const gaClientIdPattern = /_ga=([^;]*)/;
1190
+ const gaClientMatch = document.cookie.match(gaClientIdPattern);
1191
+ const gaClientMatched = gaClientMatch && gaClientMatch[1];
1192
+
1193
+ if (gaSessionMatched && gaClientMatched) {
1194
+ resolve({
1195
+ gaSessionId: gaSessionMatched,
1196
+ gaClientId: gaClientMatched,
1197
+ });
1198
+
1199
+ clearInterval(googleAnalyticsInterval);
1200
+ }
1201
+ }, googleAnalyticsConfig["checkIntervalMs"]); // Try to get the Google Analytics session data every X milliseconds
1202
+ })
1203
+
1204
+ obtainGoogleAnalyticsCookies.then(function (sessionData) {
1205
+ number.replace_tags({
1206
+ ga_session_id: sessionData.gaSessionId,
1207
+ ga_client_id: sessionData.gaClientId,
1208
+ });
1209
+ });
1210
+ }
1211
+
1212
+ function handle_true_call_integration(number) {
1213
+ trueCallConfig = get_integration_config(number, "truecall.com");
1214
+ if (typeof(trueCallConfig) == "undefined") {
1171
1215
  return;
1172
1216
  }
1173
1217
 
@@ -1185,20 +1229,18 @@
1185
1229
  })();
1186
1230
  }
1187
1231
 
1188
- const obtainTrueCallId = new Promise(function(resolve) {
1189
- const trueCallInterval = setInterval(function() {
1190
- if (window.TrueCall && window.TrueCall.getId()) {
1191
- resolve(window.TrueCall.getId())
1232
+ const trueCallInterval = setInterval(function() {
1233
+ if (window.TrueCall) {
1234
+ window.TrueCall.setDID(number.get("number")).then(function() {
1192
1235
  clearInterval(trueCallInterval);
1193
- }
1194
- }, trueCallConfig["checkIntervalMs"]); // Try to get the trueCallId every X milliseconds
1195
- })
1196
-
1197
- obtainTrueCallId.then(function (trueCallId) {
1198
- const tags = {};
1199
- tags[trueCallConfig["tagName"]] = trueCallId;
1200
- number.replace_tags(tags);
1201
- });
1236
+ return window.TrueCall.getIdAsync();
1237
+ }).then(function(trueCallId) {
1238
+ const tags = {};
1239
+ tags[trueCallConfig["tagName"]] = trueCallId;
1240
+ number.replace_tags(tags);
1241
+ });
1242
+ }
1243
+ }, trueCallConfig["checkIntervalMs"]);
1202
1244
  }
1203
1245
 
1204
1246
  var self = this;
@@ -1257,6 +1299,12 @@
1257
1299
  console.error("Could not integrate with truecall.com, ", e);
1258
1300
  }
1259
1301
 
1302
+ try {
1303
+ handle_google_analytics_integration(number);
1304
+ } catch (e) {
1305
+ console.error("Could not integrate with google analytics, ", e);
1306
+ }
1307
+
1260
1308
  // if there is a replacement in the response, replace all occurrences
1261
1309
  // of that number on the page with the retreaver number
1262
1310
  if (typeof(data.number.replacement_numbers) !== 'undefined') {
@@ -1,2 +1,2 @@
1
- /*! retreaver 19-06-2024 */
2
- if(function(a){var b={configure:function(a){var c={addr:a.host,http_prefix:"http",urlregex:"/\\/\\/[^\\/]*\\/(.*)/"};void 0!==a.prefix&&(c.http_prefix=a.prefix),window.Retreaver._connection=new b.Base.Request(c)}};a.Retreaver=b}(window),function(){void 0===window.Retreaver&&(window.Retreaver={});var a={};a.assert_required_keys=function(){for(var a=Array.prototype.slice.call(arguments),b=a.shift(),c=0;c<a.length;c++){var d=a[c];if(void 0===b||void 0===b[d])throw"ArgumentError: Required keys are not defined: "+a.join(", ")}return b},a.merge=function(b,c){for(var d in c)try{c[d].constructor==Object?b[d]=a.merge(b[d],c[d]):b[d]=c[d]}catch(a){b[d]=c[d]}return b},a.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)},a.ieVersion=function(){return null==a._ieVersion&&(a._ieVersion=function(){for(var a=3,b=document.createElement("div"),c=b.getElementsByTagName("i");b.innerHTML="\x3c!--[if gt IE "+ ++a+"]><i></i><![endif]--\x3e",c[0];);return a>4&&a}()),6!=a._ieVersion&&7!=a._ieVersion||null==Retreaver.easyxdm_loaded&&(Retreaver.easyxdm_loaded=!1),a._ieVersion},Retreaver.Base=a}(),function(a){var b=function(a,c,d){return 1===arguments.length?b.get(a):b.set(a,c,d)};b._document=document,b._navigator=navigator,b.defaults={path:"/"},b.get=function(a){return b._cachedDocumentCookie!==b._document.cookie&&b._renewCache(),b._cache[a]},b.set=function(a,c,d){return d=b._getExtendedOptions(d),b._document.cookie=b._generateCookieString(a,c,d),b},b._getExtendedOptions=function(c){return{path:c&&c.path||b.defaults.path,domain:c&&c.domain||b.defaults.domain,secure:c&&c.secure!==a?c.secure:b.defaults.secure}},b._isValidDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)&&!isNaN(a.getTime())},b._generateCookieString=function(a,b,c){return a=encodeURIComponent(a),b=(b+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent),c=c||{},a=a+"="+b+(c.path?";path="+c.path:""),a+=c.domain?";domain="+c.domain:"",a+=c.secure?";secure":""},b._getCookieObjectFromString=function(c){var d={};c=c?c.split("; "):[];for(var e=0;e<c.length;e++){var f=b._getKeyValuePairFromCookieString(c[e]);d[f.key]===a&&(d[f.key]=f.value)}return d},b._getKeyValuePairFromCookieString=function(a){var b=a.indexOf("="),b=0>b?a.length:b;return{key:decodeURIComponent(a.substr(0,b)),value:decodeURIComponent(a.substr(b+1))}},b._renewCache=function(){b._cache=b._getCookieObjectFromString(b._document.cookie),b._cachedDocumentCookie=b._document.cookie},b._areEnabled=function(){return b._navigator.cookieEnabled||"1"===b.set("cookies.js",1).get("cookies.js")},b.enabled=b._areEnabled(),"function"==typeof define&&define.amd?define(function(){return b}):"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports.Cookies=b),Retreaver.Base.Cookies=b}(),function(){var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};Base64.encode=function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Base64._utf8_encode(a);j<a.length;)b=a.charCodeAt(j++),c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=b>>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+Base64._keyStr.charAt(e)+Base64._keyStr.charAt(f)+Base64._keyStr.charAt(g)+Base64._keyStr.charAt(h);return i},Base64.decode=function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j<a.length;)e=Base64._keyStr.indexOf(a.charAt(j++)),f=Base64._keyStr.indexOf(a.charAt(j++)),g=Base64._keyStr.indexOf(a.charAt(j++)),h=Base64._keyStr.indexOf(a.charAt(j++)),b=e<<2|f>>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!=g&&(i+=String.fromCharCode(c)),64!=h&&(i+=String.fromCharCode(d));return i=Base64._utf8_decode(i)},Base64._utf8_encode=function(string){string=string.replace(eval("/\\r\\n/g"),eval("String('\\n')"));for(var utftext="",n=0;n<string.length;n++){var c=string.charCodeAt(n);c<128?utftext+=String.fromCharCode(c):c>127&&c<2048?(utftext+=String.fromCharCode(c>>6|192),utftext+=String.fromCharCode(63&c|128)):(utftext+=String.fromCharCode(c>>12|224),utftext+=String.fromCharCode(c>>6&63|128),utftext+=String.fromCharCode(63&c|128))}return utftext},Base64._utf8_decode=function(a){for(var b="",c=0,d=0,e=0,f=0;c<a.length;)d=a.charCodeAt(c),d<128?(b+=String.fromCharCode(d),c++):d>191&&d<224?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b},Retreaver.Base.Base64=Base64}(),function(){var a=Retreaver.Base,b=function(b){function c(){a.assert_required_keys(b,"type","primary_key"),void 0===Retreaver.Base.Data._store[b.type]&&(Retreaver.Base.Data._store[b.type]={}),void 0===Retreaver.Base.Data._store[b.type][b.primary_key]&&(Retreaver.Base.Data._store[b.type][b.primary_key]={})}var d=this;d.get=function(){var a={};if(void 0===arguments[0])a=Retreaver.Base.Data._store[b.type][b.primary_key];else if(1===arguments.length)a=Retreaver.Base.Data._store[b.type][b.primary_key][arguments[0]];else for(var c=0;c<arguments.length;c++){var d=arguments[c];a[d]=Retreaver.Base.Data._store[b.type][b.primary_key][d]}return a},d.set=function(a,c){return Retreaver.Base.Data._store[b.type][b.primary_key][a]=c,c},d.merge=function(a){for(var c in a)Retreaver.Base.Data._store[b.type][b.primary_key][c]=a[c];return a},c()};b._store={},Retreaver.Base.Data=b}(),function(){var a=Retreaver.Base,b=Retreaver.Base.Data,c=function(){this.api_host_uri="/api/v1/",this.type="model",this.primary_key=function(a){return c.primary_key(this.type,a)},this.store=function(a){if(void 0!==a){var b=this.primary_key();if(void 0===a[b])throw"ArgumentError: Expected to receive primary_key "+b;void 0===this._store&&(this._store=new Retreaver.Base.Data({type:this.type,primary_key:a[b]})),this._store.merge(a),c.update_visitor_id(a)}return this._store},this.get_data=function(a,b){return this.connection().getJSON(this.api_host_uri+a,null,[c.update,b],this)},this.post_data=function(a,b,d){return this.connection().postJSON(this.api_host_uri+a,b,[c.update,d],this)},this.set=function(){return"function"==typeof this["set_"+arguments[0]]&&(arguments[1]=this["set_"+arguments[0]].apply(this,[arguments[1]])),this._store.set.apply(this,arguments)},this.get=function(){return this._store.get.apply(this,arguments)},this.connection=function(){return Retreaver.Base.Request.connection()}};c.inflections={number:"numbers",campaign:"campaigns"},c.update=function(d){for(var e in d){var f=e,g=d[e];if(void 0!==c.inflections[e]&&(f=c.inflections[e]),void 0!==b._store[f])if(a.isArray(g))for(var h=0;h<g.length;h++)c.update_record(f,g[h]);else c.update_record(f,g[h])}return d},c.update_record=function(a,b){if(c.update_visitor_id(b),void 0!==b.id){var d=c.primary_key(a);for(var e in b)Retreaver.Base.Data._store[a][b[d]][e]=b[e];return!0}return!1},c.update_visitor_id=function(a){void 0!==a&&void 0!==a.visitor_id&&Retreaver.Base.Cookies.set("CallPixels-vid",a.visitor_id)},c.primary_key=function(a,b){return void 0===c.primary_keys&&(c.primary_keys={}),void 0===c.primary_keys[a]&&(c.primary_keys[a]="id"),void 0!==b&&(c.primary_keys[a]=b),c.primary_keys[a]},Retreaver.Base.Model=c}(),function(){var Base=window.Retreaver.Base,Cookies=window.Retreaver.Base.Cookies,Request=function(options){function initialize(a){config=Base.assert_required_keys(a,"http_prefix","addr","urlregex")}function with_ie_scripts(a){Retreaver.easyxdm_loaded?a():self.loadScript(http_prefix+"://cdn.jsdelivr.net/easyxdm/2.4.17.1/easyXDM.min.js",function(){self.loadScript(http_prefix+"://cdn.jsdelivr.net/easyxdm/2.4.17.1/json2.js",function(){Retreaver.easyxdm_loaded=!0,a()})})}var self=this,config={};self.getJSON=function(a,b,c,d){"function"==typeof c&&(c=[c]),void 0===d&&(d=self);var e=function(){self.apiRequest(a,function(a){var b=JSON.parse(a);for(var e in c)"function"==typeof c[e]&&c[e].apply(d,[b])},b)};6==Base.ieVersion()||7==Base.ieVersion()?with_ie_scripts(e):e()},self.postJSON=function(){return self.getJSON.apply(this,arguments)},self.apiRequest=function(request_uri,callbackFunctions,payload){function ignored(){}function runCallbacks(a){for(var b in callbackFunctions)"function"==typeof callbackFunctions[b]&&callbackFunctions[b](a)}function forwardResponse(){runCallbacks(xdr.responseText)}function sendXdm(){var remote=http_prefix+"://"+addr+"/ie_provider",swf=http_prefix+"://"+addr+"/easyxdm.swf",rpc=eval('new window.easyXDM.Rpc({ remote: "'+remote+'", swf: "'+swf+'"},{remote: {request: {}}});');rpc.request({url:"/"+request_url.match(urlregex)[1],method:"POST",data:payload},function(a){runCallbacks(a.data)})}var http_prefix=config.http_prefix,addr=config.addr,urlregex=eval(config.urlregex),request_url=http_prefix+"://"+addr+request_uri;if(payload&&void 0!==Cookies.get("CallPixels-vid")&&"null"!==Cookies.get("CallPixels-vid")&&(payload.visitor_id=Cookies.get("CallPixels-vid")),"function"==typeof callbackFunctions&&(callbackFunctions=[callbackFunctions]),window.XDomainRequest){var xdr=new XDomainRequest;xdr.onload=forwardResponse,xdr.onprogress=ignored,xdr.onerror=ignored,xdr.ontimeout=ignored,xdr.timeout=3e4,payload?(xdr.open("post",request_url),xdr.send(self.buildPost(payload))):(xdr.open("get",request_url),xdr.send())}else if(6==Base.ieVersion()||7==Base.ieVersion())with_ie_scripts(sendXdm);else{var request=new XMLHttpRequest;request.onload=function(){runCallbacks(this.responseText)},payload?(request.open("POST",request_url),request.setRequestHeader("Content-Type","application/json"),request.send(JSON.stringify(payload))):(request.open("GET",request_url),request.send())}},self.buildPost=function(a){var b="";for(var c in a)b+=c+"="+a[c]+"&";return b},self.loadScript=function(a,b){var c=document.getElementsByTagName("script")[0],d=document.createElement("script");d.type="text/javascript",d.async=!1,d.src=a;var e=function(a,b){"loaded"==a.readyState||"complete"==a.readyState?b():setTimeout(function(){e(a,b)},100)};"function"==typeof b&&(void 0!==d.addEventListener?d.addEventListener("load",b,!1):d.onreadystatechange=function(){d.onreadystatechange=null,e(d,b)}),c.parentNode.insertBefore(d,c)},initialize(options),self.config=config};Request.connection=function(){if(void 0===window.Retreaver._connection){var a=window.location.protocol.replace(":","");window.Retreaver._connection=new Retreaver.Base.Request({addr:"api.rtvrapi.com",http_prefix:a,urlregex:"/\\/\\/[^\\/]*\\/(.*)/"})}return window.Retreaver._connection},Retreaver.Base.Request=Request}(),function(){function tags_to_script_tags(a){var b="";for(var c in a){b=b+"&"+c+"="+a[c]}return b}var Base=Retreaver.Base,Cookies=Retreaver.Base.Cookies,Base64=Retreaver.Base.Base64,Request=Retreaver.Base.Request,RequestNumber=function(options){function initialize(a){config=Base.assert_required_keys(a,"campaign_key")}function getParts(a){for(var b={},c=0;c<a.length;c++){var d=getUrlParts(a[c]);for(var e in d)b[e]=d[e]}return b}function getUrlParts(url){var objURL=new Object;try{url=url.match(eval("/\\?(.*)/"))[0]}catch(a){return objURL}return url.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),function(a,b,c,d){objURL[b.toLowerCase()]=d}),objURL}function getGACookies(){var a=["__utma","__utmb","__utmc","__utmz","__utmv"],b=new Object;for(var c in a){var d=extractCookie(a[c]);if(!(d||c>0))break;d&&(b[a[c]]=d)}return b}function extractCookie(a){var b=new RegExp(a+"=([^;]*)","g");try{return b.exec(document.cookie)[1]}catch(a){return!1}}function findOne(a,b){for(var c in b)for(var d in a)if(d==b[c])return a[d];return!1}var self=this,config={},resource_url="/api/v1/numbers?";self.perform=function(callback){function sendGARequest(a,b){request_ran||(request_ran=!0,body.ga=Base64.encode(a),body.c=Base64.encode(JSON.stringify(b)),Request.connection().getJSON(request_url,body,callback))}function runRequest(){request_ran||(request_ran=!0,Request.connection().getJSON(request_url,body,callback))}if("function"!=typeof callback)throw"ArgumentError: Expected to receive a callback function";var request_url=resource_url+"&campaign_key="+config.campaign_key;config.default_number_replacement&&(request_url=request_url+"&default_number="+config.default_number_replacement),config.message_replacement&&(request_url=request_url+"&message="+config.message_replacement);var body=new Object,uri=document.location.href;body.u=Base64.encode(uri),body.st=Base64.encode(tags_to_script_tags(config.number_matching_tags));var ou=Cookies.get("CallPixels-ou");getParts([document.location.href]).cpreset||!ou?Cookies.set("CallPixels-ou",body.u):body.ou=ou;var ga_acct="FAILED",request_ran=!1;window.setTimeout(runRequest,1e3);try{_gaq.push(function(){ga_acct=eval("_gat._getTrackerByName()._getAccount()"),sendGARequest(ga_acct,getGACookies())})}catch(e){try{ga(function(tracker){if(tracker&&tracker.get)try{var clientId=tracker.get("clientId"),allTrackers=eval("ga.getAll()");ga_acct=allTrackers[0].get("trackingId");var ga_cookies={};ga_cookies.__utma=clientId,ga_cookies.mp="yes",sendGARequest(ga_acct,ga_cookies)}catch(a){sendGARequest("",{})}else sendGARequest("",{})})}catch(a){runRequest()}}},initialize(options)};Retreaver.Base.RequestNumber=RequestNumber}(),window.Retreaver.Cache={},function(){function a(b){if(void 0!==Retreaver.Base.Data._store){var c=Retreaver.Base.Data._store.numbers;if(void 0!==c){var d={};for(var e in c){var f=c[e];"true"===f.is_active&&(void 0===d[f.campaign_key]&&(d[f.campaign_key]=[],d[f.campaign_key].ids=[],d[f.campaign_key].hashes=[]),d[f.campaign_key].ids.push(f.id),d[f.campaign_key].hashes.push(f.id_checksum))}for(var g in d){var h={ids:d[g].ids,hashes:d[g].hashes};Retreaver.Base.Request.connection().postJSON("/api/v1/numbers/ping",h,[Retreaver.Base.Model.update,b],this)}}}setTimeout(a,15e3)}var b=Retreaver.Base;Retreaver.Number=function(a){function c(a){g.store(a),g.set("is_active","true")}function d(a){return"string"==typeof a&&(a=Retreaver.Number.extract_tags_from_string(a)),{tag_values:a,ids:[e("id")],campaign_key:e("campaign_key")}}function e(a){return g.get(a)}function f(){if(!1===g.get("is_per_visitor"))throw"Error: Tried to add tags to non per-visitor number."}var g=this;g.type="numbers",g.add_tags=function(a,b){f(),g.post_data("numbers/tag",d(a),b)},g.replace_tags=function(a,b){f(),g.post_data("numbers/replace_tags",d(a),b)},g.remove_tags=function(a,b){f(),g.post_data("numbers/untag",d(a),b)},g.remove_tags_by_keys=function(a,b){f(),"string"==typeof a&&(a=a.split(","));var c={tag_keys:a,ids:[e("id")],campaign_key:e("campaign_key")};g.post_data("numbers/untag/keys",c,b)},g.clear_tags=function(a){f();var b={ids:[e("id")],campaign_key:e("campaign_key"),all:"true"};g.post_data("numbers/untag",b,a)},g.release=function(){g.set("is_active","false")},g.initiate_call=function(a,c,d){void 0===c&&(c={}),c.dial=a,c=b.merge(g.get("id","campaign_key"),c),g.post_data("numbers/initiate_call",c,d)},c(a)},Retreaver.Number.extract_tags_from_string=function(a){for(var b={},a=a.split(","),c=0;c<a.length;c++){var d=a[c].split(":");b[d[0]]=d[1]}return b},Retreaver.Number.prototype=new Retreaver.Base.Model,a()}(),function(){var a=Retreaver.Base.RequestNumber,b=function(b){function c(a){f.store(a)}function d(a){for(var b=0;b<a.length;b++){var c=a[b];Retreaver.Vendor.findAndReplaceDOMText(document.getElementsByTagName("body")[0],{find:c.find,replace:c.replace_with});for(var d=document.getElementsByTagName("a"),e=0;e<d.length;e++){var f=d[e],g=f.getAttribute("href");if(null!==g){var h=g.match(/^(tel:|clk[a-z]\/tel\/)(.*)/);h&&h[2]===c.find&&f.setAttribute("href",h[1]+c.replace_with)}}}}function e(a){const b=a.get("integrations");if("object"==typeof b){const c=b["truecall.com"];if(void 0!==c){document.getElementById("__tc_script")&&window.TrueCall||function(){const a=document.createElement("script");a.type="text/javascript",a.async=!0,a.defer=!0,a.dataset.tc_campaign_id=c.tcCampaignId,a.id="__tc_script",a.src=c.scriptSrc,(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}();new Promise(function(a){const b=setInterval(function(){window.TrueCall&&window.TrueCall.getId()&&(a(window.TrueCall.getId()),clearInterval(b))},c.checkIntervalMs)}).then(function(b){const d={};d[c.tagName]=b,a.replace_tags(d)})}}}var f=this;f.type="campaigns",f.primary_key("campaign_key"),f.numbers=[],f.request_number=function(b,c,g){"function"==typeof b&&(g=c,c=b,b={}),void 0===c&&(c=function(){}),void 0===b&&(b={}),f.set("number_matching_tags",b),new a(f.get("campaign_key","number_matching_tags")).perform(function(a){if(void 0!==a&&void 0!==a.number&&""!==a.number){var b=new Retreaver.Number(a.number);try{e(b)}catch(a){console.error("Could not integrate with truecall.com, ",a)}void 0!==a.number.replacement_numbers&&d(a.number.replacement_numbers),c.apply(f,[b])}else"function"==typeof g&&g.apply(f,[a])})},f.auto_replace_numbers=function(a,b,c){void 0===b&&(b=function(){}),void 0===c&&(c=function(){}),f.request_number(a,b,c)},f.numbers=function(){var a=[];if(void 0!==Retreaver.Base.Data._store){var b=Retreaver.Base.Data._store.numbers;if(void 0!==b)for(var c in b){var d=b[c];f.get("campaign_key")==d.campaign_key&&a.push(new Retreaver.Number(d))}}return a},f.set_number_matching_tags=function(a){if("string"==typeof a&&(a=Retreaver.Number.extract_tags_from_string(a)),!a||"object"!=typeof a||a instanceof Array)throw"ArgumentError: Expected number_matching_tags to be an object. eg: {tag: 'value'}";return a},c(b)};b.prototype=new Retreaver.Base.Model,Retreaver.Campaign=b}(),function(a){a.Callpixels=window.Retreaver}(window),void 0===Retreaver)var Retreaver={};void 0===Retreaver.Vendor&&(Retreaver.Vendor={}),function(a,b){a.findAndReplaceDOMText=b()}(Retreaver.Vendor,function(){function a(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function b(){return c.apply(null,arguments)||d.apply(null,arguments)}function c(a,c,e,f,g){if(c&&!c.nodeType&&arguments.length<=2)return!1;var h="function"==typeof e;h&&(e=function(a){return function(b,c){return a(b.text,c.startIndex)}}(e));var i=d(c,{find:a,wrap:h?null:e,replace:h?e:"$"+(f||"&"),prepMatch:function(a,b){if(!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";if(f>0){var c=a[f];a.index+=a[0].indexOf(c),a[0]=c}return a.endIndex=a.index+a[0].length,a.startIndex=a.index,a.index=b,a},filterElements:g});return b.revert=function(){return i.revert()},!0}function d(a,b){return new e(a,b)}function e(a,c){var d=c.preset&&b.PRESETS[c.preset];if(c.portionMode=c.portionMode||f,d)for(var e in d)i.call(d,e)&&!i.call(c,e)&&(c[e]=d[e]);this.node=a,this.options=c,this.prepMatch=c.prepMatch||this.prepMatch,this.reverts=[],this.matches=this.search(),this.matches.length&&this.processMatches()}var f="retain",g="first",h=document,i={}.hasOwnProperty;return b.NON_PROSE_ELEMENTS={br:1,hr:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1},b.NON_CONTIGUOUS_PROSE_ELEMENTS={address:1,article:1,aside:1,blockquote:1,dd:1,div:1,dl:1,fieldset:1,figcaption:1,figure:1,footer:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,header:1,hgroup:1,hr:1,main:1,nav:1,noscript:1,ol:1,output:1,p:1,pre:1,section:1,ul:1,br:1,li:1,summary:1,dt:1,details:1,rp:1,rt:1,rtc:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1,table:1,tbody:1,thead:1,th:1,tr:1,td:1,caption:1,col:1,tfoot:1,colgroup:1},b.NON_INLINE_PROSE=function(a){return i.call(b.NON_CONTIGUOUS_PROSE_ELEMENTS,a.nodeName.toLowerCase())},b.PRESETS={prose:{forceContext:b.NON_INLINE_PROSE,filterElements:function(a){return!i.call(b.NON_PROSE_ELEMENTS,a.nodeName.toLowerCase())}}},b.Finder=e,e.prototype={search:function(){function b(a){for(var g=0,j=a.length;g<j;++g){var k=a[g];if("string"==typeof k){if(f.global)for(;c=f.exec(k);)h.push(i.prepMatch(c,d++,e));else(c=k.match(f))&&h.push(i.prepMatch(c,0,e));e+=k.length}else b(k)}}var c,d=0,e=0,f=this.options.find,g=this.getAggregateText(),h=[],i=this;return f="string"==typeof f?RegExp(a(f),"g"):f,b(g),h},prepMatch:function(a,b,c){if(!a[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return a.endIndex=c+a.index+a[0].length,a.startIndex=c+a.index,a.index=b,a},getAggregateText:function(){function a(d){if(3===d.nodeType)return[d.data];if(b&&!b(d))return[];var e=[""],f=0;if(d=d.firstChild)do{if(3!==d.nodeType){var g=a(d);c&&1===d.nodeType&&(!0===c||c(d))?(e[++f]=g,e[++f]=""):("string"==typeof g[0]&&(e[f]+=g.shift()),g.length&&(e[++f]=g,e[++f]=""))}else e[f]+=d.data}while(d=d.nextSibling);return e}var b=this.options.filterElements,c=this.options.forceContext;return a(this.node)},processMatches:function(){var a,b,c,d=this.matches,e=this.node,f=this.options.filterElements,g=[],h=e,i=d.shift(),j=0,k=0,l=0,m=[e];a:for(;;){if(3===h.nodeType&&(!b&&h.length+j>=i.endIndex?b={node:h,index:l++,text:h.data.substring(i.startIndex-j,i.endIndex-j),indexInMatch:j-i.startIndex,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,isEnd:!0}:a&&g.push({node:h,index:l++,text:h.data,indexInMatch:j-i.startIndex,indexInNode:0}),!a&&h.length+j>i.startIndex&&(a={node:h,index:l++,indexInMatch:0,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,text:h.data.substring(i.startIndex-j,i.endIndex-j)}),j+=h.data.length),c=1===h.nodeType&&f&&!f(h),a&&b){if(h=this.replaceMatch(i,a,g,b),j-=b.node.data.length-b.endIndexInNode,a=null,b=null,g=[],i=d.shift(),l=0,k++,!i)break}else if(!c&&(h.firstChild||h.nextSibling)){h.firstChild?(m.push(h),h=h.firstChild):h=h.nextSibling;continue}for(;;){if(h.nextSibling){h=h.nextSibling;break}if((h=m.pop())===e)break a}}},revert:function(){for(var a=this.reverts.length;a--;)this.reverts[a]();this.reverts=[]},prepareReplacementString:function(a,b,c){var d=this.options.portionMode;return d===g&&b.indexInMatch>0?"":(a=a.replace(/\$(\d+|&|`|')/g,function(a,b){var d;switch(b){case"&":d=c[0];break;case"`":d=c.input.substring(0,c.startIndex);break;case"'":d=c.input.substring(c.endIndex);break;default:d=c[+b]}return d}),d===g?a:b.isEnd?a.substring(b.indexInMatch):a.substring(b.indexInMatch,b.indexInMatch+b.text.length))},getPortionReplacementNode:function(a,b){var c=this.options.replace||"$&",d=this.options.wrap;if(d&&d.nodeType){var e=h.createElement("div");e.innerHTML=d.outerHTML||(new XMLSerializer).serializeToString(d),d=e.firstChild}if("function"==typeof c)return c=c(a,b),c&&c.nodeType?c:h.createTextNode(String(c));var f="string"==typeof d?h.createElement(d):d;return c=h.createTextNode(this.prepareReplacementString(c,a,b)),c.data&&f?(f.appendChild(c),f):c},replaceMatch:function(a,b,c,d){var e,f,g=b.node,i=d.node;if(g===i){var j=g;b.indexInNode>0&&(e=h.createTextNode(j.data.substring(0,b.indexInNode)),j.parentNode.insertBefore(e,j));var k=this.getPortionReplacementNode(d,a);return j.parentNode.insertBefore(k,j),d.endIndexInNode<j.length&&(f=h.createTextNode(j.data.substring(d.endIndexInNode)),j.parentNode.insertBefore(f,j)),j.parentNode.removeChild(j),this.reverts.push(function(){e===k.previousSibling&&e.parentNode.removeChild(e),f===k.nextSibling&&f.parentNode.removeChild(f),k.parentNode.replaceChild(j,k)}),k}e=h.createTextNode(g.data.substring(0,b.indexInNode)),f=h.createTextNode(i.data.substring(d.endIndexInNode));for(var l=this.getPortionReplacementNode(b,a),m=[],n=0,o=c.length;n<o;++n){var p=c[n],q=this.getPortionReplacementNode(p,a);p.node.parentNode.replaceChild(q,p.node),this.reverts.push(function(a,b){return function(){b.parentNode.replaceChild(a.node,b)}}(p,q)),m.push(q)}var r=this.getPortionReplacementNode(d,a);return g.parentNode.insertBefore(e,g),g.parentNode.insertBefore(l,g),g.parentNode.removeChild(g),i.parentNode.insertBefore(r,i),i.parentNode.insertBefore(f,i),i.parentNode.removeChild(i),this.reverts.push(function(){e.parentNode.removeChild(e),l.parentNode.replaceChild(g,l),f.parentNode.removeChild(f),r.parentNode.replaceChild(i,r)}),r}},b});
1
+ /*! retreaver 22-07-2024 */
2
+ if(function(a){var b={configure:function(a){var c={addr:a.host,http_prefix:"http",urlregex:"/\\/\\/[^\\/]*\\/(.*)/"};void 0!==a.prefix&&(c.http_prefix=a.prefix),window.Retreaver._connection=new b.Base.Request(c)}};a.Retreaver=b}(window),function(){void 0===window.Retreaver&&(window.Retreaver={});var a={};a.assert_required_keys=function(){for(var a=Array.prototype.slice.call(arguments),b=a.shift(),c=0;c<a.length;c++){var d=a[c];if(void 0===b||void 0===b[d])throw"ArgumentError: Required keys are not defined: "+a.join(", ")}return b},a.merge=function(b,c){for(var d in c)try{c[d].constructor==Object?b[d]=a.merge(b[d],c[d]):b[d]=c[d]}catch(a){b[d]=c[d]}return b},a.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)},a.ieVersion=function(){return null==a._ieVersion&&(a._ieVersion=function(){for(var a=3,b=document.createElement("div"),c=b.getElementsByTagName("i");b.innerHTML="\x3c!--[if gt IE "+ ++a+"]><i></i><![endif]--\x3e",c[0];);return a>4&&a}()),6!=a._ieVersion&&7!=a._ieVersion||null==Retreaver.easyxdm_loaded&&(Retreaver.easyxdm_loaded=!1),a._ieVersion},Retreaver.Base=a}(),function(a){var b=function(a,c,d){return 1===arguments.length?b.get(a):b.set(a,c,d)};b._document=document,b._navigator=navigator,b.defaults={path:"/"},b.get=function(a){return b._cachedDocumentCookie!==b._document.cookie&&b._renewCache(),b._cache[a]},b.set=function(a,c,d){return d=b._getExtendedOptions(d),b._document.cookie=b._generateCookieString(a,c,d),b},b._getExtendedOptions=function(c){return{path:c&&c.path||b.defaults.path,domain:c&&c.domain||b.defaults.domain,secure:c&&c.secure!==a?c.secure:b.defaults.secure}},b._isValidDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)&&!isNaN(a.getTime())},b._generateCookieString=function(a,b,c){return a=encodeURIComponent(a),b=(b+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent),c=c||{},a=a+"="+b+(c.path?";path="+c.path:""),a+=c.domain?";domain="+c.domain:"",a+=c.secure?";secure":""},b._getCookieObjectFromString=function(c){var d={};c=c?c.split("; "):[];for(var e=0;e<c.length;e++){var f=b._getKeyValuePairFromCookieString(c[e]);d[f.key]===a&&(d[f.key]=f.value)}return d},b._getKeyValuePairFromCookieString=function(a){var b=a.indexOf("="),b=0>b?a.length:b;return{key:decodeURIComponent(a.substr(0,b)),value:decodeURIComponent(a.substr(b+1))}},b._renewCache=function(){b._cache=b._getCookieObjectFromString(b._document.cookie),b._cachedDocumentCookie=b._document.cookie},b._areEnabled=function(){return b._navigator.cookieEnabled||"1"===b.set("cookies.js",1).get("cookies.js")},b.enabled=b._areEnabled(),"function"==typeof define&&define.amd?define(function(){return b}):"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports.Cookies=b),Retreaver.Base.Cookies=b}(),function(){var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};Base64.encode=function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Base64._utf8_encode(a);j<a.length;)b=a.charCodeAt(j++),c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=b>>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+Base64._keyStr.charAt(e)+Base64._keyStr.charAt(f)+Base64._keyStr.charAt(g)+Base64._keyStr.charAt(h);return i},Base64.decode=function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j<a.length;)e=Base64._keyStr.indexOf(a.charAt(j++)),f=Base64._keyStr.indexOf(a.charAt(j++)),g=Base64._keyStr.indexOf(a.charAt(j++)),h=Base64._keyStr.indexOf(a.charAt(j++)),b=e<<2|f>>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!=g&&(i+=String.fromCharCode(c)),64!=h&&(i+=String.fromCharCode(d));return i=Base64._utf8_decode(i)},Base64._utf8_encode=function(string){string=string.replace(eval("/\\r\\n/g"),eval("String('\\n')"));for(var utftext="",n=0;n<string.length;n++){var c=string.charCodeAt(n);c<128?utftext+=String.fromCharCode(c):c>127&&c<2048?(utftext+=String.fromCharCode(c>>6|192),utftext+=String.fromCharCode(63&c|128)):(utftext+=String.fromCharCode(c>>12|224),utftext+=String.fromCharCode(c>>6&63|128),utftext+=String.fromCharCode(63&c|128))}return utftext},Base64._utf8_decode=function(a){for(var b="",c=0,d=0,e=0,f=0;c<a.length;)d=a.charCodeAt(c),d<128?(b+=String.fromCharCode(d),c++):d>191&&d<224?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b},Retreaver.Base.Base64=Base64}(),function(){var a=Retreaver.Base,b=function(b){function c(){a.assert_required_keys(b,"type","primary_key"),void 0===Retreaver.Base.Data._store[b.type]&&(Retreaver.Base.Data._store[b.type]={}),void 0===Retreaver.Base.Data._store[b.type][b.primary_key]&&(Retreaver.Base.Data._store[b.type][b.primary_key]={})}var d=this;d.get=function(){var a={};if(void 0===arguments[0])a=Retreaver.Base.Data._store[b.type][b.primary_key];else if(1===arguments.length)a=Retreaver.Base.Data._store[b.type][b.primary_key][arguments[0]];else for(var c=0;c<arguments.length;c++){var d=arguments[c];a[d]=Retreaver.Base.Data._store[b.type][b.primary_key][d]}return a},d.set=function(a,c){return Retreaver.Base.Data._store[b.type][b.primary_key][a]=c,c},d.merge=function(a){for(var c in a)Retreaver.Base.Data._store[b.type][b.primary_key][c]=a[c];return a},c()};b._store={},Retreaver.Base.Data=b}(),function(){var a=Retreaver.Base,b=Retreaver.Base.Data,c=function(){this.api_host_uri="/api/v1/",this.type="model",this.primary_key=function(a){return c.primary_key(this.type,a)},this.store=function(a){if(void 0!==a){var b=this.primary_key();if(void 0===a[b])throw"ArgumentError: Expected to receive primary_key "+b;void 0===this._store&&(this._store=new Retreaver.Base.Data({type:this.type,primary_key:a[b]})),this._store.merge(a),c.update_visitor_id(a)}return this._store},this.get_data=function(a,b){return this.connection().getJSON(this.api_host_uri+a,null,[c.update,b],this)},this.post_data=function(a,b,d){return this.connection().postJSON(this.api_host_uri+a,b,[c.update,d],this)},this.set=function(){return"function"==typeof this["set_"+arguments[0]]&&(arguments[1]=this["set_"+arguments[0]].apply(this,[arguments[1]])),this._store.set.apply(this,arguments)},this.get=function(){return this._store.get.apply(this,arguments)},this.connection=function(){return Retreaver.Base.Request.connection()}};c.inflections={number:"numbers",campaign:"campaigns"},c.update=function(d){for(var e in d){var f=e,g=d[e];if(void 0!==c.inflections[e]&&(f=c.inflections[e]),void 0!==b._store[f])if(a.isArray(g))for(var h=0;h<g.length;h++)c.update_record(f,g[h]);else c.update_record(f,g[h])}return d},c.update_record=function(a,b){if(c.update_visitor_id(b),void 0!==b.id){var d=c.primary_key(a);for(var e in b)Retreaver.Base.Data._store[a][b[d]][e]=b[e];return!0}return!1},c.update_visitor_id=function(a){void 0!==a&&void 0!==a.visitor_id&&Retreaver.Base.Cookies.set("CallPixels-vid",a.visitor_id)},c.primary_key=function(a,b){return void 0===c.primary_keys&&(c.primary_keys={}),void 0===c.primary_keys[a]&&(c.primary_keys[a]="id"),void 0!==b&&(c.primary_keys[a]=b),c.primary_keys[a]},Retreaver.Base.Model=c}(),function(){var Base=window.Retreaver.Base,Cookies=window.Retreaver.Base.Cookies,Request=function(options){function initialize(a){config=Base.assert_required_keys(a,"http_prefix","addr","urlregex")}function with_ie_scripts(a){Retreaver.easyxdm_loaded?a():self.loadScript(http_prefix+"://cdn.jsdelivr.net/easyxdm/2.4.17.1/easyXDM.min.js",function(){self.loadScript(http_prefix+"://cdn.jsdelivr.net/easyxdm/2.4.17.1/json2.js",function(){Retreaver.easyxdm_loaded=!0,a()})})}var self=this,config={};self.getJSON=function(a,b,c,d){"function"==typeof c&&(c=[c]),void 0===d&&(d=self);var e=function(){self.apiRequest(a,function(a){var b=JSON.parse(a);for(var e in c)"function"==typeof c[e]&&c[e].apply(d,[b])},b)};6==Base.ieVersion()||7==Base.ieVersion()?with_ie_scripts(e):e()},self.postJSON=function(){return self.getJSON.apply(this,arguments)},self.apiRequest=function(request_uri,callbackFunctions,payload){function ignored(){}function runCallbacks(a){for(var b in callbackFunctions)"function"==typeof callbackFunctions[b]&&callbackFunctions[b](a)}function forwardResponse(){runCallbacks(xdr.responseText)}function sendXdm(){var remote=http_prefix+"://"+addr+"/ie_provider",swf=http_prefix+"://"+addr+"/easyxdm.swf",rpc=eval('new window.easyXDM.Rpc({ remote: "'+remote+'", swf: "'+swf+'"},{remote: {request: {}}});');rpc.request({url:"/"+request_url.match(urlregex)[1],method:"POST",data:payload},function(a){runCallbacks(a.data)})}var http_prefix=config.http_prefix,addr=config.addr,urlregex=eval(config.urlregex),request_url=http_prefix+"://"+addr+request_uri;if(payload&&void 0!==Cookies.get("CallPixels-vid")&&"null"!==Cookies.get("CallPixels-vid")&&(payload.visitor_id=Cookies.get("CallPixels-vid")),"function"==typeof callbackFunctions&&(callbackFunctions=[callbackFunctions]),window.XDomainRequest){var xdr=new XDomainRequest;xdr.onload=forwardResponse,xdr.onprogress=ignored,xdr.onerror=ignored,xdr.ontimeout=ignored,xdr.timeout=3e4,payload?(xdr.open("post",request_url),xdr.send(self.buildPost(payload))):(xdr.open("get",request_url),xdr.send())}else if(6==Base.ieVersion()||7==Base.ieVersion())with_ie_scripts(sendXdm);else{var request=new XMLHttpRequest;request.onload=function(){runCallbacks(this.responseText)},payload?(request.open("POST",request_url),request.setRequestHeader("Content-Type","application/json"),request.send(JSON.stringify(payload))):(request.open("GET",request_url),request.send())}},self.buildPost=function(a){var b="";for(var c in a)b+=c+"="+a[c]+"&";return b},self.loadScript=function(a,b){var c=document.getElementsByTagName("script")[0],d=document.createElement("script");d.type="text/javascript",d.async=!1,d.src=a;var e=function(a,b){"loaded"==a.readyState||"complete"==a.readyState?b():setTimeout(function(){e(a,b)},100)};"function"==typeof b&&(void 0!==d.addEventListener?d.addEventListener("load",b,!1):d.onreadystatechange=function(){d.onreadystatechange=null,e(d,b)}),c.parentNode.insertBefore(d,c)},initialize(options),self.config=config};Request.connection=function(){if(void 0===window.Retreaver._connection){var a=window.location.protocol.replace(":","");window.Retreaver._connection=new Retreaver.Base.Request({addr:"api.rtvrapi.com",http_prefix:a,urlregex:"/\\/\\/[^\\/]*\\/(.*)/"})}return window.Retreaver._connection},Retreaver.Base.Request=Request}(),function(){function tags_to_script_tags(a){var b="";for(var c in a){b=b+"&"+c+"="+a[c]}return b}var Base=Retreaver.Base,Cookies=Retreaver.Base.Cookies,Base64=Retreaver.Base.Base64,Request=Retreaver.Base.Request,RequestNumber=function(options){function initialize(a){config=Base.assert_required_keys(a,"campaign_key")}function getParts(a){for(var b={},c=0;c<a.length;c++){var d=getUrlParts(a[c]);for(var e in d)b[e]=d[e]}return b}function getUrlParts(url){var objURL=new Object;try{url=url.match(eval("/\\?(.*)/"))[0]}catch(a){return objURL}return url.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),function(a,b,c,d){objURL[b.toLowerCase()]=d}),objURL}function getGACookies(){var a=["__utma","__utmb","__utmc","__utmz","__utmv"],b=new Object;for(var c in a){var d=extractCookie(a[c]);if(!(d||c>0))break;d&&(b[a[c]]=d)}return b}function extractCookie(a){var b=new RegExp(a+"=([^;]*)","g");try{return b.exec(document.cookie)[1]}catch(a){return!1}}function findOne(a,b){for(var c in b)for(var d in a)if(d==b[c])return a[d];return!1}var self=this,config={},resource_url="/api/v1/numbers?";self.perform=function(callback){function sendGARequest(a,b){request_ran||(request_ran=!0,body.ga=Base64.encode(a),body.c=Base64.encode(JSON.stringify(b)),Request.connection().getJSON(request_url,body,callback))}function runRequest(){request_ran||(request_ran=!0,Request.connection().getJSON(request_url,body,callback))}if("function"!=typeof callback)throw"ArgumentError: Expected to receive a callback function";var request_url=resource_url+"&campaign_key="+config.campaign_key;config.default_number_replacement&&(request_url=request_url+"&default_number="+config.default_number_replacement),config.message_replacement&&(request_url=request_url+"&message="+config.message_replacement);var body=new Object,uri=document.location.href;body.u=Base64.encode(uri),body.st=Base64.encode(tags_to_script_tags(config.number_matching_tags));var ou=Cookies.get("CallPixels-ou");getParts([document.location.href]).cpreset||!ou?Cookies.set("CallPixels-ou",body.u):body.ou=ou;var ga_acct="FAILED",request_ran=!1;window.setTimeout(runRequest,1e3);try{_gaq.push(function(){ga_acct=eval("_gat._getTrackerByName()._getAccount()"),sendGARequest(ga_acct,getGACookies())})}catch(e){try{ga(function(tracker){if(tracker&&tracker.get)try{var clientId=tracker.get("clientId"),allTrackers=eval("ga.getAll()");ga_acct=allTrackers[0].get("trackingId");var ga_cookies={};ga_cookies.__utma=clientId,ga_cookies.mp="yes",sendGARequest(ga_acct,ga_cookies)}catch(a){sendGARequest("",{})}else sendGARequest("",{})})}catch(a){runRequest()}}},initialize(options)};Retreaver.Base.RequestNumber=RequestNumber}(),window.Retreaver.Cache={},function(){function a(b){if(void 0!==Retreaver.Base.Data._store){var c=Retreaver.Base.Data._store.numbers;if(void 0!==c){var d={};for(var e in c){var f=c[e];"true"===f.is_active&&(void 0===d[f.campaign_key]&&(d[f.campaign_key]=[],d[f.campaign_key].ids=[],d[f.campaign_key].hashes=[]),d[f.campaign_key].ids.push(f.id),d[f.campaign_key].hashes.push(f.id_checksum))}for(var g in d){var h={ids:d[g].ids,hashes:d[g].hashes};Retreaver.Base.Request.connection().postJSON("/api/v1/numbers/ping",h,[Retreaver.Base.Model.update,b],this)}}}setTimeout(a,15e3)}var b=Retreaver.Base;Retreaver.Number=function(a){function c(a){g.store(a),g.set("is_active","true")}function d(a){return"string"==typeof a&&(a=Retreaver.Number.extract_tags_from_string(a)),{tag_values:a,ids:[e("id")],campaign_key:e("campaign_key")}}function e(a){return g.get(a)}function f(){if(!1===g.get("is_per_visitor"))throw"Error: Tried to add tags to non per-visitor number."}var g=this;g.type="numbers",g.add_tags=function(a,b){f(),g.post_data("numbers/tag",d(a),b)},g.replace_tags=function(a,b){f(),g.post_data("numbers/replace_tags",d(a),b)},g.remove_tags=function(a,b){f(),g.post_data("numbers/untag",d(a),b)},g.remove_tags_by_keys=function(a,b){f(),"string"==typeof a&&(a=a.split(","));var c={tag_keys:a,ids:[e("id")],campaign_key:e("campaign_key")};g.post_data("numbers/untag/keys",c,b)},g.clear_tags=function(a){f();var b={ids:[e("id")],campaign_key:e("campaign_key"),all:"true"};g.post_data("numbers/untag",b,a)},g.release=function(){g.set("is_active","false")},g.initiate_call=function(a,c,d){void 0===c&&(c={}),c.dial=a,c=b.merge(g.get("id","campaign_key"),c),g.post_data("numbers/initiate_call",c,d)},c(a)},Retreaver.Number.extract_tags_from_string=function(a){for(var b={},a=a.split(","),c=0;c<a.length;c++){var d=a[c].split(":");b[d[0]]=d[1]}return b},Retreaver.Number.prototype=new Retreaver.Base.Model,a()}(),function(){var a=Retreaver.Base.RequestNumber,b=function(b){function c(a){h.store(a)}function d(a){for(var b=0;b<a.length;b++){var c=a[b];Retreaver.Vendor.findAndReplaceDOMText(document.getElementsByTagName("body")[0],{find:c.find,replace:c.replace_with});for(var d=document.getElementsByTagName("a"),e=0;e<d.length;e++){var f=d[e],g=f.getAttribute("href");if(null!==g){var h=g.match(/^(tel:|clk[a-z]\/tel\/)(.*)/);h&&h[2]===c.find&&f.setAttribute("href",h[1]+c.replace_with)}}}}function e(a,b){const c=a.get("integrations");if("object"==typeof c){const d=c[b];if(void 0!==d)return d}}function f(a){if(googleAnalyticsConfig=e(a,"google_analytics"),"undefined"!=typeof googleAnalyticsConfig){new Promise(function(a){const b=setInterval(function(){const c=/_ga_[^=]+=([^;]*)/,d=document.cookie.match(c),e=d&&d[1],f=/_ga=([^;]*)/,g=document.cookie.match(f),h=g&&g[1];e&&h&&(a({gaSessionId:e,gaClientId:h}),clearInterval(b))},googleAnalyticsConfig.checkIntervalMs)}).then(function(b){a.replace_tags({ga_session_id:b.gaSessionId,ga_client_id:b.gaClientId})})}}function g(a){if(trueCallConfig=e(a,"truecall.com"),"undefined"!=typeof trueCallConfig){document.getElementById("__tc_script")&&window.TrueCall||function(){const a=document.createElement("script");a.type="text/javascript",a.async=!0,a.defer=!0,a.dataset.tc_campaign_id=trueCallConfig.tcCampaignId,a.id="__tc_script",a.src=trueCallConfig.scriptSrc,(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}();const b=setInterval(function(){window.TrueCall&&window.TrueCall.setDID(a.get("number")).then(function(){return clearInterval(b),window.TrueCall.getIdAsync()}).then(function(b){const c={};c[trueCallConfig.tagName]=b,a.replace_tags(c)})},trueCallConfig.checkIntervalMs)}}var h=this;h.type="campaigns",h.primary_key("campaign_key"),h.numbers=[],h.request_number=function(b,c,e){"function"==typeof b&&(e=c,c=b,b={}),void 0===c&&(c=function(){}),void 0===b&&(b={}),h.set("number_matching_tags",b),new a(h.get("campaign_key","number_matching_tags")).perform(function(a){if(void 0!==a&&void 0!==a.number&&""!==a.number){var b=new Retreaver.Number(a.number);try{g(b)}catch(a){console.error("Could not integrate with truecall.com, ",a)}try{f(b)}catch(a){console.error("Could not integrate with google analytics, ",a)}void 0!==a.number.replacement_numbers&&d(a.number.replacement_numbers),c.apply(h,[b])}else"function"==typeof e&&e.apply(h,[a])})},h.auto_replace_numbers=function(a,b,c){void 0===b&&(b=function(){}),void 0===c&&(c=function(){}),h.request_number(a,b,c)},h.numbers=function(){var a=[];if(void 0!==Retreaver.Base.Data._store){var b=Retreaver.Base.Data._store.numbers;if(void 0!==b)for(var c in b){var d=b[c];h.get("campaign_key")==d.campaign_key&&a.push(new Retreaver.Number(d))}}return a},h.set_number_matching_tags=function(a){if("string"==typeof a&&(a=Retreaver.Number.extract_tags_from_string(a)),!a||"object"!=typeof a||a instanceof Array)throw"ArgumentError: Expected number_matching_tags to be an object. eg: {tag: 'value'}";return a},c(b)};b.prototype=new Retreaver.Base.Model,Retreaver.Campaign=b}(),function(a){a.Callpixels=window.Retreaver}(window),void 0===Retreaver)var Retreaver={};void 0===Retreaver.Vendor&&(Retreaver.Vendor={}),function(a,b){a.findAndReplaceDOMText=b()}(Retreaver.Vendor,function(){function a(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function b(){return c.apply(null,arguments)||d.apply(null,arguments)}function c(a,c,e,f,g){if(c&&!c.nodeType&&arguments.length<=2)return!1;var h="function"==typeof e;h&&(e=function(a){return function(b,c){return a(b.text,c.startIndex)}}(e));var i=d(c,{find:a,wrap:h?null:e,replace:h?e:"$"+(f||"&"),prepMatch:function(a,b){if(!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";if(f>0){var c=a[f];a.index+=a[0].indexOf(c),a[0]=c}return a.endIndex=a.index+a[0].length,a.startIndex=a.index,a.index=b,a},filterElements:g});return b.revert=function(){return i.revert()},!0}function d(a,b){return new e(a,b)}function e(a,c){var d=c.preset&&b.PRESETS[c.preset];if(c.portionMode=c.portionMode||f,d)for(var e in d)i.call(d,e)&&!i.call(c,e)&&(c[e]=d[e]);this.node=a,this.options=c,this.prepMatch=c.prepMatch||this.prepMatch,this.reverts=[],this.matches=this.search(),this.matches.length&&this.processMatches()}var f="retain",g="first",h=document,i={}.hasOwnProperty;return b.NON_PROSE_ELEMENTS={br:1,hr:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1},b.NON_CONTIGUOUS_PROSE_ELEMENTS={address:1,article:1,aside:1,blockquote:1,dd:1,div:1,dl:1,fieldset:1,figcaption:1,figure:1,footer:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,header:1,hgroup:1,hr:1,main:1,nav:1,noscript:1,ol:1,output:1,p:1,pre:1,section:1,ul:1,br:1,li:1,summary:1,dt:1,details:1,rp:1,rt:1,rtc:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1,table:1,tbody:1,thead:1,th:1,tr:1,td:1,caption:1,col:1,tfoot:1,colgroup:1},b.NON_INLINE_PROSE=function(a){return i.call(b.NON_CONTIGUOUS_PROSE_ELEMENTS,a.nodeName.toLowerCase())},b.PRESETS={prose:{forceContext:b.NON_INLINE_PROSE,filterElements:function(a){return!i.call(b.NON_PROSE_ELEMENTS,a.nodeName.toLowerCase())}}},b.Finder=e,e.prototype={search:function(){function b(a){for(var g=0,j=a.length;g<j;++g){var k=a[g];if("string"==typeof k){if(f.global)for(;c=f.exec(k);)h.push(i.prepMatch(c,d++,e));else(c=k.match(f))&&h.push(i.prepMatch(c,0,e));e+=k.length}else b(k)}}var c,d=0,e=0,f=this.options.find,g=this.getAggregateText(),h=[],i=this;return f="string"==typeof f?RegExp(a(f),"g"):f,b(g),h},prepMatch:function(a,b,c){if(!a[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return a.endIndex=c+a.index+a[0].length,a.startIndex=c+a.index,a.index=b,a},getAggregateText:function(){function a(d){if(3===d.nodeType)return[d.data];if(b&&!b(d))return[];var e=[""],f=0;if(d=d.firstChild)do{if(3!==d.nodeType){var g=a(d);c&&1===d.nodeType&&(!0===c||c(d))?(e[++f]=g,e[++f]=""):("string"==typeof g[0]&&(e[f]+=g.shift()),g.length&&(e[++f]=g,e[++f]=""))}else e[f]+=d.data}while(d=d.nextSibling);return e}var b=this.options.filterElements,c=this.options.forceContext;return a(this.node)},processMatches:function(){var a,b,c,d=this.matches,e=this.node,f=this.options.filterElements,g=[],h=e,i=d.shift(),j=0,k=0,l=0,m=[e];a:for(;;){if(3===h.nodeType&&(!b&&h.length+j>=i.endIndex?b={node:h,index:l++,text:h.data.substring(i.startIndex-j,i.endIndex-j),indexInMatch:j-i.startIndex,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,isEnd:!0}:a&&g.push({node:h,index:l++,text:h.data,indexInMatch:j-i.startIndex,indexInNode:0}),!a&&h.length+j>i.startIndex&&(a={node:h,index:l++,indexInMatch:0,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,text:h.data.substring(i.startIndex-j,i.endIndex-j)}),j+=h.data.length),c=1===h.nodeType&&f&&!f(h),a&&b){if(h=this.replaceMatch(i,a,g,b),j-=b.node.data.length-b.endIndexInNode,a=null,b=null,g=[],i=d.shift(),l=0,k++,!i)break}else if(!c&&(h.firstChild||h.nextSibling)){h.firstChild?(m.push(h),h=h.firstChild):h=h.nextSibling;continue}for(;;){if(h.nextSibling){h=h.nextSibling;break}if((h=m.pop())===e)break a}}},revert:function(){for(var a=this.reverts.length;a--;)this.reverts[a]();this.reverts=[]},prepareReplacementString:function(a,b,c){var d=this.options.portionMode;return d===g&&b.indexInMatch>0?"":(a=a.replace(/\$(\d+|&|`|')/g,function(a,b){var d;switch(b){case"&":d=c[0];break;case"`":d=c.input.substring(0,c.startIndex);break;case"'":d=c.input.substring(c.endIndex);break;default:d=c[+b]}return d}),d===g?a:b.isEnd?a.substring(b.indexInMatch):a.substring(b.indexInMatch,b.indexInMatch+b.text.length))},getPortionReplacementNode:function(a,b){var c=this.options.replace||"$&",d=this.options.wrap;if(d&&d.nodeType){var e=h.createElement("div");e.innerHTML=d.outerHTML||(new XMLSerializer).serializeToString(d),d=e.firstChild}if("function"==typeof c)return c=c(a,b),c&&c.nodeType?c:h.createTextNode(String(c));var f="string"==typeof d?h.createElement(d):d;return c=h.createTextNode(this.prepareReplacementString(c,a,b)),c.data&&f?(f.appendChild(c),f):c},replaceMatch:function(a,b,c,d){var e,f,g=b.node,i=d.node;if(g===i){var j=g;b.indexInNode>0&&(e=h.createTextNode(j.data.substring(0,b.indexInNode)),j.parentNode.insertBefore(e,j));var k=this.getPortionReplacementNode(d,a);return j.parentNode.insertBefore(k,j),d.endIndexInNode<j.length&&(f=h.createTextNode(j.data.substring(d.endIndexInNode)),j.parentNode.insertBefore(f,j)),j.parentNode.removeChild(j),this.reverts.push(function(){e===k.previousSibling&&e.parentNode.removeChild(e),f===k.nextSibling&&f.parentNode.removeChild(f),k.parentNode.replaceChild(j,k)}),k}e=h.createTextNode(g.data.substring(0,b.indexInNode)),f=h.createTextNode(i.data.substring(d.endIndexInNode));for(var l=this.getPortionReplacementNode(b,a),m=[],n=0,o=c.length;n<o;++n){var p=c[n],q=this.getPortionReplacementNode(p,a);p.node.parentNode.replaceChild(q,p.node),this.reverts.push(function(a,b){return function(){b.parentNode.replaceChild(a.node,b)}}(p,q)),m.push(q)}var r=this.getPortionReplacementNode(d,a);return g.parentNode.insertBefore(e,g),g.parentNode.insertBefore(l,g),g.parentNode.removeChild(g),i.parentNode.insertBefore(r,i),i.parentNode.insertBefore(f,i),i.parentNode.removeChild(i),this.reverts.push(function(){e.parentNode.removeChild(e),l.parentNode.replaceChild(g,l),f.parentNode.removeChild(f),r.parentNode.replaceChild(i,r)}),r}},b});
@@ -389,7 +389,7 @@ Calls campaign.request_number
389
389
 
390
390
  <dt class="tag-source">Source:</dt>
391
391
  <dd class="tag-source"><ul class="dummy"><li>
392
- <a href="campaign.js.html">retreaver/campaign.js</a>, <a href="campaign.js.html#line156">line 156</a>
392
+ <a href="campaign.js.html">retreaver/campaign.js</a>, <a href="campaign.js.html#line204">line 204</a>
393
393
  </li></ul></dd>
394
394
 
395
395
 
@@ -589,7 +589,7 @@ Calls campaign.request_number
589
589
 
590
590
  <dt class="tag-source">Source:</dt>
591
591
  <dd class="tag-source"><ul class="dummy"><li>
592
- <a href="campaign.js.html">retreaver/campaign.js</a>, <a href="campaign.js.html#line90">line 90</a>
592
+ <a href="campaign.js.html">retreaver/campaign.js</a>, <a href="campaign.js.html#line132">line 132</a>
593
593
  </li></ul></dd>
594
594
 
595
595
 
@@ -645,7 +645,7 @@ Calls campaign.request_number
645
645
  <br clear="both">
646
646
 
647
647
  <footer>
648
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Wed Jun 19 2024 12:13:17 GMT+0300 (EEST)
648
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jul 22 2024 11:07:14 GMT+0300 (EEST)
649
649
  </footer>
650
650
 
651
651
  <script> prettyPrint(); </script>
@@ -1606,7 +1606,7 @@ with per-visitor numbers enabled.
1606
1606
  <br clear="both">
1607
1607
 
1608
1608
  <footer>
1609
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Wed Jun 19 2024 12:13:17 GMT+0300 (EEST)
1609
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jul 22 2024 11:07:14 GMT+0300 (EEST)
1610
1610
  </footer>
1611
1611
 
1612
1612
  <script> prettyPrint(); </script>
@@ -318,7 +318,7 @@
318
318
  <br clear="both">
319
319
 
320
320
  <footer>
321
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Wed Jun 19 2024 12:13:17 GMT+0300 (EEST)
321
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jul 22 2024 11:07:14 GMT+0300 (EEST)
322
322
  </footer>
323
323
 
324
324
  <script> prettyPrint(); </script>
@@ -67,15 +67,59 @@
67
67
  }
68
68
  }
69
69
 
70
- function handle_true_call_integration(number) {
70
+ function get_integration_config(number, integration) {
71
71
  const integrations = number.get("integrations");
72
72
 
73
- if (typeof(integrations) != 'object'){
73
+ if (typeof(integrations) != 'object') {
74
+ return;
75
+ }
76
+
77
+ const integrationConfig = integrations[integration];
78
+ if (typeof(integrationConfig) == 'undefined') {
74
79
  return;
75
80
  }
76
81
 
77
- const trueCallConfig = integrations["truecall.com"];
78
- if (typeof(trueCallConfig) == 'undefined') {
82
+ return integrationConfig;
83
+ }
84
+
85
+ function handle_google_analytics_integration(number) {
86
+ googleAnalyticsConfig = get_integration_config(number, "google_analytics");
87
+ if (typeof(googleAnalyticsConfig) == "undefined") {
88
+ return;
89
+ }
90
+
91
+ const obtainGoogleAnalyticsCookies = new Promise(function(resolve) {
92
+ const googleAnalyticsInterval = setInterval(function() {
93
+ const gaSessionIdPattern = /_ga_[^=]+=([^;]*)/;
94
+ const gaSessionMatch = document.cookie.match(gaSessionIdPattern);
95
+ const gaSessionMatched = gaSessionMatch && gaSessionMatch[1];
96
+
97
+ const gaClientIdPattern = /_ga=([^;]*)/;
98
+ const gaClientMatch = document.cookie.match(gaClientIdPattern);
99
+ const gaClientMatched = gaClientMatch && gaClientMatch[1];
100
+
101
+ if (gaSessionMatched && gaClientMatched) {
102
+ resolve({
103
+ gaSessionId: gaSessionMatched,
104
+ gaClientId: gaClientMatched,
105
+ });
106
+
107
+ clearInterval(googleAnalyticsInterval);
108
+ }
109
+ }, googleAnalyticsConfig["checkIntervalMs"]); // Try to get the Google Analytics session data every X milliseconds
110
+ })
111
+
112
+ obtainGoogleAnalyticsCookies.then(function (sessionData) {
113
+ number.replace_tags({
114
+ ga_session_id: sessionData.gaSessionId,
115
+ ga_client_id: sessionData.gaClientId,
116
+ });
117
+ });
118
+ }
119
+
120
+ function handle_true_call_integration(number) {
121
+ trueCallConfig = get_integration_config(number, "truecall.com");
122
+ if (typeof(trueCallConfig) == "undefined") {
79
123
  return;
80
124
  }
81
125
 
@@ -93,20 +137,18 @@
93
137
  })();
94
138
  }
95
139
 
96
- const obtainTrueCallId = new Promise(function(resolve) {
97
- const trueCallInterval = setInterval(function() {
98
- if (window.TrueCall && window.TrueCall.getId()) {
99
- resolve(window.TrueCall.getId())
140
+ const trueCallInterval = setInterval(function() {
141
+ if (window.TrueCall) {
142
+ window.TrueCall.setDID(number.get("number")).then(function() {
100
143
  clearInterval(trueCallInterval);
101
- }
102
- }, trueCallConfig["checkIntervalMs"]); // Try to get the trueCallId every X milliseconds
103
- })
104
-
105
- obtainTrueCallId.then(function (trueCallId) {
106
- const tags = {};
107
- tags[trueCallConfig["tagName"]] = trueCallId;
108
- number.replace_tags(tags);
109
- });
144
+ return window.TrueCall.getIdAsync();
145
+ }).then(function(trueCallId) {
146
+ const tags = {};
147
+ tags[trueCallConfig["tagName"]] = trueCallId;
148
+ number.replace_tags(tags);
149
+ });
150
+ }
151
+ }, trueCallConfig["checkIntervalMs"]);
110
152
  }
111
153
 
112
154
  var self = this;
@@ -165,6 +207,12 @@
165
207
  console.error("Could not integrate with truecall.com, ", e);
166
208
  }
167
209
 
210
+ try {
211
+ handle_google_analytics_integration(number);
212
+ } catch (e) {
213
+ console.error("Could not integrate with google analytics, ", e);
214
+ }
215
+
168
216
  // if there is a replacement in the response, replace all occurrences
169
217
  // of that number on the page with the retreaver number
170
218
  if (typeof(data.number.replacement_numbers) !== 'undefined') {
@@ -264,7 +312,7 @@
264
312
  <br clear="both">
265
313
 
266
314
  <footer>
267
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Wed Jun 19 2024 12:13:17 GMT+0300 (EEST)
315
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jul 22 2024 11:07:13 GMT+0300 (EEST)
268
316
  </footer>
269
317
 
270
318
  <script> prettyPrint(); </script>
@@ -178,7 +178,7 @@
178
178
 
179
179
  <dt class="tag-source">Source:</dt>
180
180
  <dd class="tag-source"><ul class="dummy"><li>
181
- <a href="campaign.js.html">retreaver/campaign.js</a>, <a href="campaign.js.html#line183">line 183</a>
181
+ <a href="campaign.js.html">retreaver/campaign.js</a>, <a href="campaign.js.html#line231">line 231</a>
182
182
  </li></ul></dd>
183
183
 
184
184
 
@@ -223,7 +223,7 @@
223
223
  <br clear="both">
224
224
 
225
225
  <footer>
226
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Wed Jun 19 2024 12:13:17 GMT+0300 (EEST)
226
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jul 22 2024 11:07:13 GMT+0300 (EEST)
227
227
  </footer>
228
228
 
229
229
  <script> prettyPrint(); </script>
@@ -58,7 +58,7 @@
58
58
  <br clear="both">
59
59
 
60
60
  <footer>
61
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Wed Jun 19 2024 12:13:17 GMT+0300 (EEST)
61
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jul 22 2024 11:07:13 GMT+0300 (EEST)
62
62
  </footer>
63
63
 
64
64
  <script> prettyPrint(); </script>
@@ -265,7 +265,7 @@
265
265
  <br clear="both">
266
266
 
267
267
  <footer>
268
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Wed Jun 19 2024 12:13:17 GMT+0300 (EEST)
268
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jul 22 2024 11:07:13 GMT+0300 (EEST)
269
269
  </footer>
270
270
 
271
271
  <script> prettyPrint(); </script>
@@ -74,7 +74,7 @@
74
74
  <br clear="both">
75
75
 
76
76
  <footer>
77
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Wed Jun 19 2024 12:13:17 GMT+0300 (EEST)
77
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jul 22 2024 11:07:13 GMT+0300 (EEST)
78
78
  </footer>
79
79
 
80
80
  <script> prettyPrint(); </script>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retreaverjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
4
+ version: 0.2.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Hilscher
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-06-19 00:00:00.000000000 Z
12
+ date: 2024-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties