diff --git a/commerce_nosto_tagging.module b/commerce_nosto_tagging.module index d7d925f..afd901e 100644 --- a/commerce_nosto_tagging.module +++ b/commerce_nosto_tagging.module @@ -35,14 +35,14 @@ function commerce_nosto_tagging_init() { $account_name = variable_get(COMMERCE_NOSTO_TAGGING_CONFIG_KEY_ACCOUNT_NAME, ''); if (!empty($server_address) && !empty($account_name)) { - drupal_add_js(drupal_get_path('module', 'commerce_nosto_tagging') . '/js/embed.js', array( + drupal_add_js(drupal_get_path('module', 'commerce_nosto_tagging') . '/js/nostoloader.js', array( 'type' => 'file', 'scope' => 'header', 'group' => JS_DEFAULT, 'every_page' => TRUE, )); - $js = 'embedjs(\'' . check_plain($server_address) . '\', \'/include/' . check_plain($account_name) . '\');'; + $js = 'nostojs.init(\'' . check_plain($account_name) . '\', {host:\'' . check_plain($server_address) . '\'});'; drupal_add_js($js, array( 'type' => 'inline', 'scope' => 'header', diff --git a/js/nostoloader.js b/js/nostoloader.js new file mode 100644 index 0000000..ecc9a88 --- /dev/null +++ b/js/nostoloader.js @@ -0,0 +1,6 @@ +/** + * @file + * Nosto marketing automation service JavaScript. + */ + +(function(){function a(a){var b,c,d=window.document.createElement("iframe");d.src="javascript:false",(d.frameElement||d).style.cssText="width: 0; height: 0; border: 0";var e=window.document.createElement("div");e.style.display="none";var f=window.document.createElement("div");e.appendChild(f),window.document.body.insertBefore(e,window.document.body.firstChild),f.appendChild(d);try{c=d.contentWindow.document}catch(g){b=document.domain,d.src="javascript:var d=document.open();d.domain='"+b+"';void(0);",c=d.contentWindow.document}return c.open()._l=function(){b&&(this.domain=b);var c=this.createElement("scr".concat("ipt"));c.src=a,this.body.appendChild(c)},c.write("')),c.close(),d}var b="nostojs";window[b]=window[b]||function(a){(window[b].q=window[b].q||[]).push(a)},window[b].l=new Date;var c=function(d,e){if(!document.body)return setTimeout(function(){c(d,e)},30);e=e||{},window[b].o=e;var f=document.location.protocol,g=["https:"===f?f:"http:","//",e.host||"connect.nosto.com",e.path||"/include/",d].join("");a(g)};window[b].init=c})();