Reply
Highlighted
Frequent Visitor
Posts: 2
Registered: ‎02-06-2019

Power BI Embedded into WordPress

Hello,

 

I need to embed a dashboard into my wordpress. Here is the code I'm trying to embed:

 

<head>
<head>
<html>
  <title>Test</title>
  <script src="C:\Users\jbust\OneDrive\Escritorio\scripts\powerbi.js"></script>
</head>
<body>
  <div id="captionArea">
    <h1>Power BI Embed</h1>
  </div>
  <div id="embedContainer" style="height:500px">
  </div>
  <script>
    (function () {
      var txtAccessToken = 'txtAccessToken';
      var txtEmbedUrl ='txtEmbedUrl';
      var txtEmbedReportId = 'txtEmbedReportId';	 
	 
     var models = window['powerbi-client'].models;
     var permissions = models.Permissions.Read;
     var config = {
        type: 'report',
        tokenType: models.TokenType.Embed,
        accessToken: txtAccessToken,
        embedUrl: txtEmbedUrl,
        id: txtEmbedReportId,
        permissions: permissions,
		settings: {
          filterPaneEnabled: false,
          navContentPaneEnabled: false
        }
      };
 
      var embedContainer = document.getElementById('embedContainer');
      var report = powerbi.embed(embedContainer, config);
    }());
  </script>
</body>
</html>

I don't know much about wordpress or html but when I save this code as .html it works but when I try to paste the code into a new page on my website it doesn't work. I think the problem might be this line of code:

 

<script src="C:\Users\jbust\OneDrive\Escritorio\scripts\powerbi.js"></script>

But if tried to change it into this:

 

  <script src="https://raw.githubusercontent.com/Microsoft/PowerBI-Developer-Samples/master/App%20Owns%20Data/PowerBIEmbedded_AppOwnsData/Scripts/powerbi.js"></script>

Does not work either. 

 

Any advice would be appreciated!

 

Thanks in advance