Submit Article Requests

Do you have a suggestion for an article you would like to see created?
Feel free to submit this form and add your suggestions to our document board.

Please fill out the contact form below and we will reply as soon as possible.

  • Appcues Certifications & Training
  • Contact Us
  • Home
  • Installation & Developers
  • Troubleshooting

Using Appcues with RequireJS (Developer)

Updated at November 28th, 2022

Submit Article Requests

Do you have a suggestion for an article you would like to see created?
Feel free to submit this form and add your suggestions to our document board.

Please fill out the contact form with the details about the help content you'd like to see.

  • Installation & Developers
    Installing Appcues Installing Appcues Mobile API & Data Troubleshooting Extras
  • User Experiences
    Web Experiences Building Web Experiences Building Mobile Experiences Customization & Styling Targeting Studio Troubleshooting Use Cases FAQ
  • Mobile
    Installation & Overview Building Mobile Experiences Mobile Analytics Troubleshooting Mobile Use Cases
  • Account Management
    Subscription Users & Data
  • Analytics
    Experience and Event Analytics Data
  • Best Practices
    Use Cases Pro Tips PLG FAQ
  • Integrations
    Integration Documents Use Cases Resources
  • Post-mortem
    System Incidents
+ More

Table of Contents

Loading Appcues as a window global while RequireJS is present on the page Loading Appcues as a module in your application

Appcues can be used with AMD loaders, like RequireJS. If you used an AMD loader on your site, you'll want to read this doc. There are two scenarios:

  • You're loading Appcues as a window global and don't want it registered as module within your application
  • Or, you're trying to load Appcues as a module inside your application

Loading Appcues as a window global while RequireJS is present on the page

If your site uses an AMD loader, like RequireJS, to load modules, Appcues will attempt to define itself as a module once it detects the AMD loader on the page. If you're not actually planning to use Appcues as module in your application but instead want it be defined as window global, you'll need to set an option on the page to tell the Appcues script to defer defining itself as an AMD module and instead proceed to define itself as a window global. This can be accomplished by adding an AppcuesSettings object to the window. This code should be placed directly before the <script> tag for the Appcues:

<script type="text/javascript">
  window.AppcuesSettings = {
    skipAMD: true
  };
</script>

Loading Appcues as a module in your application

If you'd like to load Appcues through an AMD loader, like RequireJS, you can load it using the following snippet:

requirejs.config({    
  "paths": {
    "appcues": "//fast.appcues.com/<your_appcues_id>.js"    
  }
});

Later in your app, you can access the Appcues library with something like this:

// As an example,  we identify the user
define(['models/user', 'appcues'], function(user, Appcues) {
  Appcues.identify(user.id, {
    email: user.email,
    name: user.first_name + ' ' + user.last_name    
  });
});

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Requirements for Using Appcues
  • Using Appcues with IFrames
  • Anonymous Users (Developer)
Appcues logo

Product

Why Appcues
How it works
Integrations
Security
Pricing
What's new

Use cases

User Onboarding Software
Feature Adoption Software
NPS & Surveys
Announcements
Insights
Mobile Adoption

Company

About
Careers
we're Hiring

Support

Developer Docs
Contact

Resources

The Appcues Blog
Product Adoption Academy
GoodUX
Case studies
Webinar Series
Made with Appcues
Appcues University

Follow us

Facebook iconTwitter icon greyLinkedin iconInstagram icon
© 2022 Appcues. All rights reserved.
SecurityTerms of ServicePrivacy Policy
Expand