All Collections
Segmentation & Insights and Onsite Content Personalization
How to use JavaScript in Onsite Content campaigns
How to use JavaScript in Onsite Content campaigns
Lari Lehtonen avatar
Written by Lari Lehtonen
Updated over a week 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?