Skip to main content
All CollectionsOnsite Content Personalization (OCP)
How to use JavaScript in Onsite Content campaigns
How to use JavaScript in Onsite Content campaigns
Alina Marques avatar
Written by Alina Marques
Updated over 4 years ago

If you wish to embed a client-side script (JavaScript) within a Nosto Onsite Content campaign, you need to target the right window object.

As the Nosto JS is loaded in an iframe, the scripts are executed in another window context. This is useful since it prevents the script from clashing with other scripts on the site.

_targetWindow must be used to target the right window. For example if you are loading jQuery on your site, instead of calling $ or jQuery, you would use it by calling _targetWindow.$ or _targetWindow.jQuery.

Did this answer your question?