Version Migration Guide

The JavaScript SDK v1.1 is a lightweight, more efficient, and optimized version of the RudderStack JavaScript SDK.

The JavaScript SDK v1.1 offers the following features:

  • The size of the SDK is reduced by approximately 70%, considerably reducing its loading time.
  • The destination SDKs are separated from the core JavaScript SDK. They are now published as individual plugins.
  • The device mode destinations will be loaded dynamically as per your specified dashboard configurations.

JavaScript SDK v1 vs. v1.1

Parameterv1v1.1
Size114 KB*34 KB*
Device mode destination SDKsAll the device mode destination SDKs are bundled with the core SDK.The device mode destination SDKs are dynamically loaded as per the source configuration in the dashboard.

The SDK size may vary in the future as we add more functionalities.

Migrating to v1.1

This section covers the steps to migrate to v1.1 of the JavaScript SDK, depending on your previous installation of the JavaScript SDK (v1).

Case 1: Loading the SDK from the RudderStack CDN

If you are loading the JavaScript SDK from RudderStack's CDN, update the script tag in your website.

For v1:

<script src="https://cdn.rudderlabs.com/v1/rudder-analytics.min.js" />

For v1.1:

<script src="https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js" />

Case 2: Forwarding/proxying the RudderStack CDN

If you are forwarding or proxying RudderStack's CDN, follow these steps:

  • Log into your CDN provider account.
  • Go to the distribution whose origin is set to RudderStack's CDN. Ensure that the entire domain (https://cdn.rudderlabs.com) is set as the origin.

We highly recommend forwarding the entire CDN path https://cdn.rudderlabs.com so that you don't miss any files/directories that might be added in the future.

Refer to our guide on using custom domains for more information CDN forwarding/proxying.

  • Then, go to Behaviors, and check that the sub-path /v1.1/* is not configured to be blocked in any way.

This step is required to ensure that both the core SDK and destination SDKs are forwarded properly.

  • Finally, update the script tag in your website as shown:

For v1:

<script src="https://<subdomain>.<yourdomain>.com/v1/rudder-analytics.min.js" />

For v1.1:

<script src="https://<subdomain>.<yourdomain>.com/v1.1/rudder-analytics.min.js" />

Case 3: Self-hosting RudderStack's CDN

If you have cloned RudderStack's JavaScript SDK and are self-hosting it via your own CDN, follow the steps below:

We recommend maintaining the following structure:

Recommended structure for self-hosting RudderStack's CDN
  • Next, check if the core SDK filename is different than rudder-analytics.min.js. If yes, update the script tag in your website as shown below:
<script>
// rudderanalytics object initialization
// ...
// ...
// provide the location of the destination SDKs in the load options
rudderanalytics.load(<WRITE_KEY>, <DATA_PLANE_URL>, {
destSDKBaseURL: "https://cdn.<yourdomain>.com/js-integrations"
});
// ...
// ...
</script>
<script src="https://cdn.<yourdomain>.com/your-custom-analytics-file.js"></script>
  • If the core SDK filename is rudder-analytics.min.js, verify if the destination SDKs are located next to the core SDK file under the js-integrations directory (as highlighted in the tip above). If yes, update the script tag in your website as shown:
<script src="https://cdn.<yourdomain>.com/rudder-analytics.min.js"></script>
  • If the destination SDKs are not located next to the core SDK file under the js-integrations directory, then update the script tag as shown:
<script>
// rudderanalytics object initialization
// ...
// ...
// provide the location of the destination SDKs in the load options
rudderanalytics.load(<WRITE_KEY>, <DATA_PLANE_URL>, {
destSDKBaseURL: "https://cdn.<yourdomain>.com/custom-js-integrations"
});
// ...
// ...
</script>
<script src="https://cdn.<yourdomain>.com/rudder-analytics.min.js"></script>

RudderStack destination SDKs

Destination nameDownload path
HubSpothttps://cdn.rudderlabs.com/v1.1/js-integrations/HubSpot.min.js
Google Analyticshttps://cdn.rudderlabs.com/v1.1/js-integrations/GA.min.js
Hotjarhttps://cdn.rudderlabs.com/v1.1/js-integrations/Hotjar.min.js
Google Adshttps://cdn.rudderlabs.com/v1.1/js-integrations/GoogleAds.min.js
VWOhttps://cdn.rudderlabs.com/v1.1/js-integrations/VWO.min.js
Google Tag Managerhttps://cdn.rudderlabs.com/v1.1/js-integrations/GoogleTagManager.min.js
Brazehttps://cdn.rudderlabs.com/v1.1/js-integrations/Braze.min.js
Intercomhttps://cdn.rudderlabs.com/v1.1/js-integrations/INTERCOM.min.js
Keen.iohttps://cdn.rudderlabs.com/v1.1/js-integrations/Keen.min.js
Kissmetricshttps://cdn.rudderlabs.com/v1.1/js-integrations/Kissmetrics.min.js
Customer.iohttps://cdn.rudderlabs.com/v1.1/js-integrations/CustomerIO.min.js
Chartbeathttps://cdn.rudderlabs.com/v1.1/js-integrations/Chartbeat.min.js
Comscorehttps://cdn.rudderlabs.com/v1.1/js-integrations/Comscore.min.js
Facebook Pixelhttps://cdn.rudderlabs.com/v1.1/js-integrations/FacebookPixel.min.js
Lotamehttps://cdn.rudderlabs.com/v1.1/js-integrations/Lotame.min.js
Optimizelyhttps://cdn.rudderlabs.com/v1.1/js-integrations/Optimizely.min.js
BugSnaghttps://cdn.rudderlabs.com/v1.1/js-integrations/Bugsnag.min.js
FullStoryhttps://cdn.rudderlabs.com/v1.1/js-integrations/Fullstory.min.js
TVSquaredhttps://cdn.rudderlabs.com/v1.1/js-integrations/TVSquared.min.js
Google Analytics 4https://cdn.rudderlabs.com/v1.1/js-integrations/GA4.min.js
MoEngagehttps://cdn.rudderlabs.com/v1.1/js-integrations/MoEngage.min.js
Amplitudehttps://cdn.rudderlabs.com/v1.1/js-integrations/Amplitude.min.js
Pendohttps://cdn.rudderlabs.com/v1.1/js-integrations/Pendo.min.js
Lyticshttps://cdn.rudderlabs.com/v1.1/js-integrations/Lytics.min.js
Appcueshttps://cdn.rudderlabs.com/v1.1/js-integrations/Appcues.min.js
PostHoghttps://cdn.rudderlabs.com/v1.1/js-integrations/Posthog.min.js
Klaviyohttps://cdn.rudderlabs.com/v1.1/js-integrations/Klaviyo.min.js
CleverTaphttps://cdn.rudderlabs.com/v1.1/js-integrations/Clevertap.min.js
Bing Adshttps://cdn.rudderlabs.com/v1.1/js-integrations/BingAds.min.js
Pinterest Taghttps://cdn.rudderlabs.com/v1.1/js-integrations/PinterestTag.min.js
Adobe Analyticshttps://cdn.rudderlabs.com/v1.1/js-integrations/AdobeAnalytics.min.js
LinkedIn Insight Taghttps://cdn.rudderlabs.com/v1.1/js-integrations/LinkedInInsightTag.min.js
Reddit Pixelhttps://cdn.rudderlabs.com/v1.1/js-integrations/RedditPixel.min.js
Driphttps://cdn.rudderlabs.com/v1.1/js-integrations/Drip.min.js
Heaphttps://cdn.rudderlabs.com/v1.1/js-integrations/Heap.min.js
Criteohttps://cdn.rudderlabs.com/v1.1/js-integrations/Criteo.min.js
Mixpanelhttps://cdn.rudderlabs.com/v1.1/js-integrations/Mixpanel.min.js
Qualtricshttps://cdn.rudderlabs.com/v1.1/js-integrations/Qualtrics.min.js

FAQs

How are the destination SDKs loaded in v1.1?

In v1.1, the core JavaScript SDK does not contain any destination-specific SDKs by default. Depending on the device mode destinations configured in your dashboard (control plane), the necessary SDKs are dynamically fetched from the hosted location.

The hosted location can be either of:

  • RudderStack's CDN
  • Your CDN that proxies the RudderStack CDN, or
  • A self-hosted domain

Refer to the Migrating to v1.1 section above for more details.

How does RudderStack determine the destination SDKs' root location?

RudderStack follows the below precedence order while determining the root location of the destination SDKs:

  1. RudderStack refers to the destSDKBaseURL value in the options parameter of the load API call.
  2. If absent, RudderStack then checks the src attribute of the <script> tag that adds the core JavaScript SDK to your website. /js-integrations is automatically appended to the root location.
  3. If none of the two options above are applicable, RudderStack uses the default CDN URL (https://cdn.rudderlabs.com/v1.1/js-integrations/).

The above approach ensures that minimal changes are required from your end.

Contact us

In case of any issues or questions on any of the sections covered in this guide, you can contact us or start a conversation on our Slack channel.