Chili Piper can provide a hosted version of our script/snippet to launch Concierge. Some unique use cases exist where a local copy may be preferred or used to solve a more significant issue.
This article will detail a few ways you can obtain a local copy. However, you or your team will be responsible for developing a strategy for downloading the remote version periodically to ensure it is up-to-date.
Why use a local copy?
By default, most customers use our remotely hosted marketing.js for Concierge:
<script src="https://js.chilipiper.com/marketing.js"></script>
While this is always an option for you, it can be helpful to serve a locally hosted copy of our snippet to solve some use cases, for example:
Avoiding Popup Blockers:
Since Concierge's marketing.js loads as a popup modal and is a third-party script, some ad-blockers mistakenly prevent this from popping up when a customer submits a form. We have found that a locally hosted copy on your domain is less likely to be flagged incorrectly as a popup.
Security, CSP, and CORS-related issues:
Both CSP and CORS protect your landing page from malicious threats. However, this sometimes means your website will block Chili Piper's domain (js.chilipiper.com) and prevent our script from loading. A locally hosted copy will be running on the same domain/service as your other page scripts, so allowlisting our domain would not be required.
Performance:
Accessing a script from your own server will always be faster than accessing it from a third-party server. This can only mean a difference of milliseconds or seconds, but your page's loading time sometimes matters. This will not improve the overall performance of how the marketing.js script functions, though, since it still calls our servers when a form is submitted.
Installing JavaScript
You should be able to download our updated marketing.js file from the following URL: js.chilipiper.com/marketing.js
After downloading/saving it, the next step would be re-uploading it in your website's source code to ensure it will be loaded for new form submissions.
You would then include it on your page with your own hosting location:
<script src="https://YOUR_DOMAIN_LOCATION/marketing.js"></script>
Node.js NPM Version
If your landing page is developed within a Node environment, you can include our marketing.js script by installing it as a package.
NPM Reference: https://www.npmjs.com/package/@chilipiper/concierge
Start using @chilipiper/concierge in your project by running
Version 1:
First, install the package into your project:
npm i @chilipiper/concierge
This installs Concierge within a "dist" folder that can be included on any landing page:
const ChiliPiper = require('@chilipiper/concierge/dist/marketing.js');
Version 2:
If you prefer to use something like "Copy-Webpack-Plugin," here's an example of what that might look like:
config.plugins.push(
new CopyPlugin({
patterns: [{
from: '../../node_modules/@chilipiper/concierge/dist/marketing.js'
to: path.resolve(__dirname, 'public/scripts/marketing.js')
}]
})
)
With the above example, you would then call it on the page using this snippet:
<script src="./scripts/marketing.js"></script>
Next Steps
Make sure to remove any Chili Piper-hosted version of the marketing.js before implementing these solutions to prevent issues.
Ideally, you will download the local copy of Concierge regularly to ensure it stays up-to-date, and the usual preference here is to automate it.
How you automate it will depend on your environment, but some suggestions include the following:
- AWS lambda function
- Google Cloud scheduler
- Cron job
- Backoffice script that GETs source and writes it again
These advanced topics should be managed by a professional web development team or hosting agency.