LogoLogo
  • Contributing to RudderStack
  • Destination_Name
  • LICENSE
  • RudderStack Docs
  • docs
    • FAQ
    • Identity Resolution
    • Home
    • cloud-extract-sources
      • ActiveCampaign Source
      • Bing Ads
      • Chargebee
      • Common Settings
      • Facebook Ads
      • Freshdesk
      • Google Ads Source
      • Google Analytics
      • Google Search Console
      • Google Sheets
      • Cloud Extract Sources
      • Intercom v2
      • Intercom
      • Mailchimp
      • Marketo
      • Mixpanel
      • NetSuite
      • Pipedrive
      • QuickBooks
      • Salesforce Pardot
      • Sendgrid Source
      • Stripe Source
      • Xero
      • Zendesk Chat
      • Zendesk
      • hubspot
        • HubSpot Data Model and Schema Information
        • HubSpot
      • salesforce
        • Salesforce
        • Schema Comparison: RudderStack vs. Segment
    • connections
      • Connection Modes: Cloud Mode vs. Device Mode
    • data-governance
      • Data Governance
      • RudderTyper
      • Data Governance API
      • RudderTyper
      • tracking-plans
        • Tracking Plans
        • Tracking Plan Spreadsheet
    • data-warehouse-integrations
      • Amazon Redshift
      • Azure Data Lake
      • Azure Synapse
      • ClickHouse
      • Databricks Delta Lake
      • Google Cloud Storage Data Lake
      • Google BigQuery
      • Identity Resolution
      • Warehouse Destinations
      • Microsoft SQL Server
      • PostgreSQL
      • Amazon S3 Data Lake
      • Snowflake
      • FAQ
      • Warehouse Schema
    • destinations
      • Destinations
      • Webhooks
      • advertising
        • Bing Ads
        • Criteo
        • DCM Floodlight
        • Facebook App Events
        • Facebook Custom Audience
        • Facebook Pixel
        • Google Ads (gtag.js)
        • Google AdWords Enhanced Conversions
        • Google Adwords Remarketing Lists (Customer Match)
        • Advertising
        • LinkedIn Insight Tag
        • Lotame
        • Pinterest Tag
        • Reddit Pixel
        • Snap Pixel
        • TikTok Ads
      • analytics
        • Amplitude
        • AWS Personalize
        • Chartbeat
        • Firebase
        • FullStory
        • Google Analytics 360
        • Google Analytics
        • Heap.io
        • Hotjar
        • Analytics
        • Indicative
        • Keen
        • Kissmetrics
        • Kubit
        • Lytics
        • Mixpanel
        • Pendo
        • PostHog
        • Quantum Metric
        • Singular
        • adobe-analytics
          • Adobe Analytics Heartbeat Measurement
          • Mobile Device Mode Settings
          • Web Device Mode Settings
          • E-commerce Events
          • Adobe Analytics
          • Setting Up Adobe Analytics in RudderStack
        • google-analytics-4
          • Cloud Mode
          • Device Mode
          • Google Analytics 4
          • Setting up Google Analytics 4
        • profitwell
          • ProfitWell
          • Cloud Mode
          • Device Mode
      • attribution
        • Adjust
        • AppsFlyer
        • Branch
        • Attribution
        • Kochava
        • TVSquared
      • business-messaging
        • Business Messaging
        • Intercom
        • Kustomer
        • Slack
        • Trengo
      • continuous-integration
        • Visual Studio App Center
        • Continuous Integration
      • crm
        • Delighted
        • HubSpot
        • CRM
        • Salesforce
        • Variance
        • Zendesk
      • customer-data-platform
        • Customer Data Platform
        • Segment
      • error-reporting
        • Bugsnag
        • Error Reporting
        • Sentry
      • marketing
        • ActiveCampaign
        • AdRoll
        • Airship
        • Appcues
        • Autopilot
        • Blueshift
        • Braze
        • CleverTap
        • Customer.io
        • Gainsight PX
        • Gainsight
        • Marketing
        • Iterable
        • Klaviyo
        • Leanplum
        • Mailchimp
        • Marketo Lead Import
        • Marketo
        • MoEngage
        • Ometria
        • Pardot
        • Post Affiliate Pro
        • Qualtrics
        • SendGrid
        • Salesforce Marketing Cloud
        • Userlist
        • drip
          • Cloud Mode
          • Device Mode
          • Drip
          • Setting Up Drip in RudderStack
      • productivity
        • Google Sheets
        • Productivity
      • storage-platforms
        • Amazon S3
        • DigitalOcean Spaces
        • Google Cloud Storage
        • Storage Platforms
        • Azure Blob Storage
        • MinIO
        • Redis
      • streaming-platforms
        • Amazon EventBridge
        • Amazon Kinesis Firehose
        • Amazon Kinesis
        • Azure Event Hubs
        • BigQuery Stream
        • Confluent Cloud
        • Google Pub/Sub
        • Streaming Platforms
        • Apache Kafka
      • tag-managers
        • Google Tag Manager
        • Tag Managers
      • testing-and-personalization
        • Algolia Insights
        • Candu
        • Google Optimize
        • A/B Testing & Personalization
        • LaunchDarkly
        • Monetate
        • Optimizely Full Stack
        • Optimizely Web
        • Split.io
        • Statsig
        • VWO (Visual Website Optimizer)
    • get-started
      • RudderStack Cloud vs. RudderStack Open Source
      • Glossary
      • Get Started
      • RudderStack Architecture
    • reverse-etl
      • Amazon Redshift
      • Amazon S3
      • ClickHouse
      • FAQ
      • Google BigQuery
      • Reverse ETL
      • PostgreSQL
      • Snowflake
      • common-settings
        • Importing Data using Models
        • Importing Data using Tables
        • Common Settings
        • Sync Modes
        • Sync Schedule
      • features
        • Airflow Provider
        • Features
        • Models
        • Visual Data Mapper
    • rudderstack-api
      • Data Regulation API
      • HTTP API
      • RudderStack API
      • Personal Access Tokens
      • Pixel API
      • Test API
      • api-specification
        • Application Lifecycle Events Specification
        • API Specification
        • Video Events Specification
        • rudderstack-ecommerce-events-specification
          • Browsing
          • Coupons
          • E-Commerce Events Specification
          • Ordering
          • Promotions
          • Reviewing
          • Sharing
          • Wishlist
        • rudderstack-spec
          • Alias
          • Common Fields
          • Group
          • Identify
          • RudderStack Event Specification
          • Page
          • Screen
          • Track
    • rudderstack-cloud
      • Audit Logs
      • Dashboard Overview
      • Destinations
      • RudderStack Cloud
      • Live Events
      • Connection Modes: Cloud Mode vs. Device Mode
      • Sources
      • Teammates (User Management)
      • connections
        • Adding a Destination
        • Connections
    • rudderstack-open-source
      • Control Plane Setup
      • RudderStack Open Source
      • installing-and-setting-up-rudderstack
        • Developer Machine Setup
        • Docker
        • Data Plane Setup
        • Kubernetes
        • Sending Test Events
    • stream-sources
      • App Center
      • AppsFlyer
      • Auth0
      • Braze
      • Customer.io
      • Extole
      • Event Stream Sources
      • Iterable
      • Looker
      • PostHog
      • Segment
      • Shopify
      • Webhook Source
      • rudderstack-sdk-integration-guides
        • Client-side Event Filtering
        • SDKs
        • AMP Analytics
        • Cordova
        • .NET
        • Go
        • Java
        • Node.js
        • PHP
        • Python
        • React Native
        • Ruby
        • Rust
        • Unity
        • SDK FAQs
        • rudderstack-android-sdk
          • Adding Application Class
          • Flushing Events Periodically
          • Android
        • rudderstack-flutter-sdk
          • Flutter SDK v1
          • Flutter v2
          • Flutter
        • rudderstack-ios-sdk
          • iOS
          • tvOS
          • watchOS
        • rudderstack-javascript-sdk
          • Data Storage in Cookies
          • Detecting Ad-blocked Pages
          • JavaScript
          • JavaScript SDK Enhancements
          • JavaScript SDK FAQs
          • Querystring API
          • Quick Start Guide
          • Version Migration Guide
          • consent-managers
            • Consent Managers
            • OneTrust
    • transformations
      • Access Token
      • FAQ
      • Transformations
      • Transformations API
    • user-guides
      • User Guides
      • administrators-guide
        • Troubleshooting Guide
        • Alerting Guide
        • Bucket Configuration Settings for Event Backups
        • Configuration Parameters
        • Event Replay
        • High Availability
        • Horizontal Scaling
        • Administrator's Guides
        • Infrastructure Provisioning
        • Monitoring and Metrics
        • Okta SSO Setup
        • OneLogin SSO Setup
        • RudderStack Grafana Dashboard
        • Software Releases
      • how-to-guides
        • How to Use Custom Domains
        • How to Develop Integrations for RudderStack
        • How to Configure a Destination via the Event Payload
        • How to Filter Events using Different Methods
        • How to Filter Selective Destinations
        • How to Submit a Pull Request for a New Integration
        • How-to Guides
        • How to Debug Live Destination Events
        • How to Use AWS Lambda Functions with RudderStack
        • create-a-new-destination-transformer-for-rudder
          • Best Practices for Coding Transformation Functions in JavaScript
          • How to Create a New Destination Transformation for RudderStack
        • implement-native-js-sdk-integration
          • How to Add a Device Mode SDK to RudderStack JavaScript SDK
          • How to Implement a Native JavaScript SDK Integration
        • rudderstack-jamstack-integration
          • How to Integrate RudderStack with Your JAMstack Site
          • How to Integrate Rudderstack with Your Angular App
          • How to Integrate Rudderstack with Your Astro Site
          • How to Integrate Rudderstack with Your Eleventy Site
          • How to Integrate Rudderstack with Your Ember.js App
          • How to Integrate Rudderstack with a Gatsby Website
          • How to Integrate Rudderstack with a Hugo Site
          • How to Integrate Rudderstack with Your Jekyll Site
          • How to Integrate Rudderstack with Your Next.js App
          • How to Integrate Rudderstack with Your Nuxt.js App
          • How to Integrate Rudderstack with Your Svelte App
          • How to Integrate Rudderstack with Your Vue App
      • migration-guides
        • Migrating from Blendo to RudderStack
        • Migrating Your Warehouse Destination from Segment to RudderStack
        • Migration Guides
        • Migrating from Segment to RudderStack
  • src
    • @rocketseat
      • gatsby-theme-docs
        • text
          • Home
Powered by GitBook
On this page
  • JavaScript SDK v1 vs. v1.1
  • Migrating to v1.1
  • Case 1: Loading the SDK from the RudderStack CDN
  • Case 2: Forwarding/proxying the RudderStack CDN
  • Case 3: Self-hosting RudderStack's CDN
  • Updating version using NPM
  • Loading device mode destinations
  • RudderStack destination SDKs
  • FAQ
  • How are the destination SDKs loaded in v1.1?
  • How does RudderStack determine the destination SDKs' root location?
  • Contact us

Was this helpful?

  1. docs
  2. stream-sources
  3. rudderstack-sdk-integration-guides
  4. rudderstack-javascript-sdk

Version Migration Guide

Step-by-step guide on migrating from the RudderStack JavaScript SDK v1 to v1.1.

PreviousQuick Start GuideNextconsent-managers

Last updated 3 years ago

Was this helpful?

The JavaScript SDK v1.1 is a lightweight, more efficient, and optimized version of the and 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 destinations are loaded dynamically as per your specified dashboard configurations.

JavaScript SDK v1 vs. v1.1

Parameter
v1
v1.1

Size

114 KB*

34 KB*

Device mode destination SDKs

All 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:

  1. Log into your CDN provider account.

  2. Go to the distribution and set the origin to RudderStack's CDN. Ensure that the entire domain (https://cdn.rudderlabs.com) is set as the origin.

It is highly recommended to forward the entire CDN path https://cdn.rudderlabs.com so that you don't miss any files/directories that might be added in the future.

  1. Then, go to Behaviors and verify 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.

  1. 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:

  1. Move all the downloaded files to your preferred location.

The destination SDK names should not be changed as the custom names are not supported by RudderStack.

It is recommended to maintain the following structure:

  1. Next, check the core SDK's file name:

  • If it is not rudder-analytics.min.js, update the script tag in your website, 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/js-integrations"
});
// ...
// ...
</script>

<script src="https://cdn.<yourdomain>.com/<your-custom-analytics-file>.js"></script>
  • If it is rudder-analytics.min.js and:

    • The destination SDKs are located next to the core SDK file under the js-integrations directory (as highlighted in the tip above), update the script tag as shown:

      <script src="https://cdn.<yourdomain>.com/rudder-analytics.min.js"></script>
    • The destination SDKs are not located next to the core SDK file under the js-integrations directory, 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>

Updating version using NPM

The latest NPM package is based on JavaScript SDK v1.1 architecture and is released with the 2.x.x version. To update the SDK package using NPM, use any of the following options:

  • Upgrade rudder-sdk-js package to the latest version using the below command:

npm install rudder-sdk-js@latest
  • Upgrade rudder-sdk-js package to a specific version using the below command:

npm install rudder-sdk-js@2.x.x
  • Manually modify the package.json file like below and run npm install:

"dependencies": {
  "rudder-sdk-js": "^2.x.x"
}

Loading device mode destinations

The device mode destinations are loaded from https://cdn.rudderlabs.com/v1.1/js-integrations/ in 2.x.x, depending on the dashboard settings. However you can also choose to load them by using any of the below-mentioned ways:

Forwarding/proxying the RudderStack CDN

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

  1. Log into your CDN provider account.

  2. Go to the distribution and set the origin to RudderStack's CDN. Ensure that the entire domain (https://cdn.rudderlabs.com) is set as the origin.

It is highly recommended to forward the entire CDN path https://cdn.rudderlabs.com so that you don't miss any files/directories that might be added in the future.

  1. Then, go to Behaviors and verify that the sub-path /v1.1/js-integrations/* 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.

  1. Finally, use destSDKBaseURL option in the SDK's load() call, as shown:

rudderanalytics.load( <WRITE_KEY> , <DATA_PLANE_URL> , {
  destSDKBaseURL: "<your-custom-path-for-device-mode-destination>", // ex: "https://cdn.<yourdomain>.com/js-integrations"
  ...otherOptions
});

Self-hosting RudderStack's device mode SDKs

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

  1. Move all the downloaded files to your preferred location.

  2. Use destSDKBaseURL option in the SDK's load() call, as shown:

rudderanalytics.load( <WRITE_KEY> , <DATA_PLANE_URL> , {
  destSDKBaseURL: "<your-custom-path-for-device-mode-destination>", // ex: "https://cdn.<yourdomain>.com/js-integrations"
  ...otherOptions
});

The destination SDK names should not be changed as the custom names are not supported by RudderStack.

RudderStack destination SDKs

Destination name
Download path

HubSpot

https://cdn.rudderlabs.com/v1.1/js-integrations/HubSpot.min.js

Google Analytics

https://cdn.rudderlabs.com/v1.1/js-integrations/GA.min.js

Hotjar

https://cdn.rudderlabs.com/v1.1/js-integrations/Hotjar.min.js

Google Ads

https://cdn.rudderlabs.com/v1.1/js-integrations/GoogleAds.min.js

VWO

https://cdn.rudderlabs.com/v1.1/js-integrations/VWO.min.js

Google Tag Manager

https://cdn.rudderlabs.com/v1.1/js-integrations/GoogleTagManager.min.js

Braze

https://cdn.rudderlabs.com/v1.1/js-integrations/Braze.min.js

Intercom

https://cdn.rudderlabs.com/v1.1/js-integrations/INTERCOM.min.js

Keen.io

https://cdn.rudderlabs.com/v1.1/js-integrations/Keen.min.js

Kissmetrics

https://cdn.rudderlabs.com/v1.1/js-integrations/Kissmetrics.min.js

Customer.io

https://cdn.rudderlabs.com/v1.1/js-integrations/CustomerIO.min.js

Chartbeat

https://cdn.rudderlabs.com/v1.1/js-integrations/Chartbeat.min.js

Comscore

https://cdn.rudderlabs.com/v1.1/js-integrations/Comscore.min.js

Facebook Pixel

https://cdn.rudderlabs.com/v1.1/js-integrations/FacebookPixel.min.js

Lotame

https://cdn.rudderlabs.com/v1.1/js-integrations/Lotame.min.js

Optimizely

https://cdn.rudderlabs.com/v1.1/js-integrations/Optimizely.min.js

BugSnag

https://cdn.rudderlabs.com/v1.1/js-integrations/Bugsnag.min.js

FullStory

https://cdn.rudderlabs.com/v1.1/js-integrations/Fullstory.min.js

TVSquared

https://cdn.rudderlabs.com/v1.1/js-integrations/TVSquared.min.js

Google Analytics 4

https://cdn.rudderlabs.com/v1.1/js-integrations/GA4.min.js

MoEngage

https://cdn.rudderlabs.com/v1.1/js-integrations/MoEngage.min.js

Amplitude

https://cdn.rudderlabs.com/v1.1/js-integrations/Amplitude.min.js

Pendo

https://cdn.rudderlabs.com/v1.1/js-integrations/Pendo.min.js

Lytics

https://cdn.rudderlabs.com/v1.1/js-integrations/Lytics.min.js

Appcues

https://cdn.rudderlabs.com/v1.1/js-integrations/Appcues.min.js

PostHog

https://cdn.rudderlabs.com/v1.1/js-integrations/Posthog.min.js

Klaviyo

https://cdn.rudderlabs.com/v1.1/js-integrations/Klaviyo.min.js

CleverTap

https://cdn.rudderlabs.com/v1.1/js-integrations/Clevertap.min.js

Bing Ads

https://cdn.rudderlabs.com/v1.1/js-integrations/BingAds.min.js

Pinterest Tag

https://cdn.rudderlabs.com/v1.1/js-integrations/PinterestTag.min.js

Adobe Analytics

https://cdn.rudderlabs.com/v1.1/js-integrations/AdobeAnalytics.min.js

LinkedIn Insight Tag

https://cdn.rudderlabs.com/v1.1/js-integrations/LinkedInInsightTag.min.js

Reddit Pixel

https://cdn.rudderlabs.com/v1.1/js-integrations/RedditPixel.min.js

Drip

https://cdn.rudderlabs.com/v1.1/js-integrations/Drip.min.js

Heap

https://cdn.rudderlabs.com/v1.1/js-integrations/Heap.min.js

Criteo

https://cdn.rudderlabs.com/v1.1/js-integrations/Criteo.min.js

Mixpanel

https://cdn.rudderlabs.com/v1.1/js-integrations/Mixpanel.min.js

Qualtrics

https://cdn.rudderlabs.com/v1.1/js-integrations/Qualtrics.min.js

Quantum Metric

https://cdn.rudderlabs.com/v1.1/js-integrations/QuantumMetric.min.js

ProfitWell

https://cdn.rudderlabs.com/v1.1/js-integrations/ProfitWell.min.js

Sentry

https://cdn.rudderlabs.com/v1.1/js-integrations/Sentry.min.js

Google Optimize

https://cdn.rudderlabs.com/v1.1/js-integrations/GoogleOptimize.min.js

Post Affiliate Pro

https://cdn.rudderlabs.com/v1.1/js-integrations/PostAffiliatePro.min.js

LaunchDarkly

https://cdn.rudderlabs.com/v1.1/js-integrations/LaunchDarkly.min.js

Google Analytics 360

https://cdn.rudderlabs.com/v1.1/js-integrations/GA360.min.js

FAQ

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.

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

Contact us

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

Download the core .

Download all the destination SDKs listed .

For more information on CDN forwarding/proxying, refer to the guide.

Download the destination SDKs listed .

If none of the two options above are applicable, RudderStack uses the default CDN URL ().

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

RudderStack JavaScript SDK
device mode
using custom domains
JavaScript SDK v1.1
Using Custom Domains
https://cdn.rudderlabs.com/v1.1/js-integrations/
contact us
Slack
here
here
Recommended structure for self-hosting RudderStack's CDN