Embedding a Widget
Widgets are embedded by adding scripts and tags directly in the source code of your webpages. These scripts and tags need to be set in accordance with the type of authentication required. Some widgets are embedded to require authentication, while others are embedded to not require authentication.
Caution:
Do not mix authentication modes within the same page or application context. Doing so can cause several issues.- Browser Blocking: Safari and other browsers may block content when authenticated widgets are embedded in non-authenticated pages.
- Authentication Conflicts: Mixing widgets can trigger unexpected authentication workflows.
The best practice is to use the same authentication approach for all widgets on a page. Either all widgets should require OpenID Connect authentication, or all widgets should require pre-authenticated / non-authenticated contexts.
Embedding Content Requiring Authentication
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Page Title</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="https://ei-util-stage.opower.com/ei/x/embedded-api/core.js?auth-mode=oauth"></script> </head> <body> <div> <opower-widget-neighbor-comparison></opower-widget-neighbor-comparison> </div> <div> <opower-widget-data-browser></opower-widget-data-browser> </div> </body> </html>
The instructions below guide you through each step of the process and provide more background information about each the scripts and tags that are required.
Caution:
If you are using Oracle Infinity to track engagement analytics for your website, then you must load your Oracle Analytics Infinity CX Tag on your webpage before completing the steps below. Otherwise, analytics tracking for your widgets will not work. See Tracking User Interaction Analytics for instructions. You can ignore this step if you are not using Oracle Analytics Infinity.To prepare a webpage for embedding content requiring authentication:
Embedding Content Not Requiring Authentication
<!DOCTYPE html> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Page Title</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="https://ei-util-stage.opower.com/ei/x/embedded-api/core.js?auth-mode=none"></script> </head> <body> <div> <opower-widget-survey opower-instance="widget-survey-easyopen-splash"></opower-widget-survey> </div> </body> </html>
The instructions below guide you through each step of the process and provide more background information about each of the scripts and tags that are required.
Caution:
If you are using Oracle Infinity to track engagement analytics for your website, then you must load your Oracle Analytics Infinity CX Tag on your webpage before completing the steps below. Otherwise, analytics tracking for your widgets will not work. See Tracking User Interaction Analytics for instructions. You can ignore this step if you are not using Oracle Analytics Infinity.To prepare a webpage for embedding content not requiring authentication: