When i run the code it doesn't show anything even tho i know that the url does work. Can someone please help me out? Kind regards", "answerCount": 2, "upvoteCount": 0, "datePublished": "2020-04-17T10:39:53.000Z", "author": { "@type": "Person", "name": "Tableau Community Forums Member (Inactive)", "url": "https://trailblazers.salesforce.com/profileView?u=005KX000003dXo4YAE", "affiliation": { "@type": "Organization", "name": "Salesforce" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "You have an extra quote at the end of your vizURL string. Additionally, you should probably add a body to your HTML and create the div that you are referencing in vizDiv, but you don't need that if you are just testing.", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D5KX00000kQcof0AC", "datePublished": "2020-06-09T17:02:03.000Z", "author": { "@type": "Person", "name": "Tableau Community Forums Member (Inactive)", "url": "https://trailblazers.salesforce.com/profileView?u=005KX000003dXo4YAE", "affiliation": { "@type": "Organization", "name": "Salesforce" } } } ] } } Skip to main content

Hallo,

 

Im trying to write a code that gives the user a feedback when he interactes with a dahsboard. For example when the user clicks on the dashboard he gets a massege like "Marks have been selected". The code that im trying to use is as followed:

 

<!DOCTYPE html>

<html>

 

<head>

    <title>Respond to Events</title>

 

    <script type="text/javascript"

    src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>

 

    <script type="text/javascript">

var viz, workbook;

 

window.onload= function() {

var vizDiv = document.getElementById('viz');

var vizURL = "https://public.tableau.com/views/Superstore_15813300746930/Overview?:embed=y&:display_count=y&:origin=viz_share_link"";

var options = {

width: '600px',

height: '540px',

hideToolbar: true,

hideTabs: true,

onFirstInteractive: function () {

workbook = viz.getWorkbook();

}

};

viz = new tableauSoftware.Viz(vizDiv, vizURL, options);

viz.addEventListener('marksselection',function () {

alert('Marks have been selected');

});

};

</Script>

</head>

</html>

 

When i run the code it doesn't show anything even tho i know that the url does work. Can someone please help me out?

 

Kind regards

2 answers
  1. Jun 9, 2020, 5:02 PM

    You have an extra quote at the end of your vizURL string. Additionally, you should probably add a body to your HTML and create the div that you are referencing in vizDiv, but you don't need that if you are just testing.

0/9000