I am trying to add this javascript to my Wix site, and am getting this error no matter where I try to add it: Parsing Error: Unexpected Token <
Here is the full code, it is copied exactly from the CRM generating it. It is for web tracking. Am I missing something?
piAId = '824723';
piCId = '1369';
piHostname = 'pi.pardot.com';
( function () {
function async_load() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js';
var c = document.getElementsByTagName('script')[0];
c.parentNode.insertBefore(s, c);
}
if (window.attachEvent) { window.attachEvent('onload', async_load); } **else** { window.addEventListener('load', async_load, **false** ); }
})(); <
/script>
Any help is appreciated. Thank you.
The code above is HTML code which Wix does not use and not Javascript which Wix does use.
If you are wanting to add HTML to your website, then you need to add it through a HTML iFrame or through a custom tool in Tracking and Analytics.
https://support.wix.com/en/article/using-iframes-to-display-visible-content-on-your-site
https://support.wix.com/en/article/embedding-custom-code-to-your-site
Also, note that Wix does not provide support for codes supplied from third party providers, so if you have any issues with it, then you need to go through Pardot own support and ask them how to integrate it with Wix.
https://www.pardot.com/resources/pardot-customer-experience/
Important:
Wix cannot provide support for external codes that were not created or tested with Wix.
**If you are experiencing an issue with your code snippet, please contact the provider directly. **
A much better and more secure way of working, would be to use their API and use Wix Fetch or Wix HTTP Functions.
http://developer.pardot.com/