Skip to content

Commit

Permalink
Revert initialization to kit skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
SbDove committed May 24, 2024
1 parent f0f2865 commit 579ef8e
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions src/initialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,31 @@ var initialization = {
*/
initForwarder: function(forwarderSettings, testMode, userAttributes, userIdentities, processEvent, eventQueue, isInitialized, common, appVersion, appName, customFlags, clientId) {
/* `forwarderSettings` contains your SDK specific settings such as apiKey that your customer needs in order to initialize your SDK properly */

if (!testMode) {
/* Load your Web SDK here using a variant of your snippet from your readme that your customers would generally put into their <head> tags
Generally, our integrations create script tags and append them to the <head>. Please follow the following format as a guide:
*/

if (!window.heap) {
var heapScript = document.createElement('script');
heapScript.type = 'text/javascript';
heapScript.async = true;
heapScript.src = 'https://cdn.heapanalytics.com/js/heap-' + forwarderSettings.appId + '.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(heapScript);
heapScript.onload = function() {
isInitialized = true;

if (window.heap && eventQueue.length > 0) {
// Process any events that may have been queued up while forwarder was being initialized.
for (var i = 0; i < eventQueue.length; i++) {
processEvent(eventQueue[i]);
}
// now that each queued event is processed, we empty the eventQueue
eventQueue = [];
}
window.heap.load(forwarderSettings.appId);
};
} else {
isInitialized = true;
}



// var clientScript = document.createElement('script');
// clientScript.type = 'text/javascript';
// clientScript.async = true;
// clientScript.src = 'https://www.clientscript.com/static/clientSDK.js'; // <---- Update this to be your script
// (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(clientScript);
// clientScript.onload = function() {
// if (clientSDKObject && eventQueue.length > 0) {
// // Process any events that may have been queued up while forwarder was being initialized.
// for (var i = 0; i < eventQueue.length; i++) {
// processEvent(eventQueue[i]);
// }
// // now that each queued event is processed, we empty the eventQueue
// eventQueue = [];
// }
// clientSDKObject.initialize(forwarderSettings.apiKey);
// };
} else {
// For testing, you should fill out this section in order to ensure any required initialization calls are made,
// window.heap.initialize(forwarderSettings.apiKey)
// clientSDKObject.initialize(forwarderSettings.apiKey)
}
}
};
Expand Down

0 comments on commit 579ef8e

Please sign in to comment.