Hello! I'm need to capture the event `openSchedule...
# gooddata-platform
l
Hello! I'm need to capture the event
openScheduleEmailDialog
from the iframe, I'm logging each event on browser console, but it doesn`t looks its been dispatched, could you check it?
m
Hello Luis, the “openScheduleEmailDialog” event is captured in the browser console as shown in the attached example. Could you please recheck the events and check if it’s there? If you need further assistance, please feel free to send via DM a screencast or HAR file of the issue.
l
Just to check, you send manually this postmessage with the event? Or in an dashboard iframe do you click on "More options" > "Schedule Email...", like the image bellow
m
The event is only logged if you invoke it via the API. If you click the button in the UI, then it will not be logged
l
Via API, it would be postmessage?
So I think I can't do it, because I'm using iframe, and don't want to add an button to call this
There's someway to do it with the iframe?
m
We call the Usedby2 enpoint when clicking the button, it is not specific to scheduled emails, but you could test if it serves for your use case. Otherwise, could you explain what you are trying to achieve and how critical it is for your business operations?
l
We are capturing this event to understand the usage of our clients, this event specifically is not so important like others that we are capturing
But is interesting that some Commands, just by clicking on interface I can capture they, like addWidget
Without send any specific Command, by postmessage or calling the API
I'm not familiar with this Usedby2 endpoint, do you have the link for me?
m
Yes, there is a Community thread related to it here: https://community.gooddata.com/metrics-and-maql-57/list-unused-object-713
l
But in this case, we not interact with the interface, all is done by API
m
The endpoint call can be seen in the logs when you click the button:
l
I see, and in the example that you share with me, you not use this endpoint, you invoke the method with postmessage?
m
It is called after clicking the scheduled email button, however, as stated previously, the endpoint is really not explanative as it is not specifically related to the scheduled email functionality. I don’t think there is an endpoint at this time that can be traceable via the browser events that is specific to it.
l
But in this example, you are using the React components?
m
It is just a regular embedded dashboard. Could you let me know how are you working with the embedded dashboard, I will consult this further and circle back to you any additional details.
l
I have an React App that have a component with the iframe, only Then I use an useEffect hook to listen the events on iframe
Copy code
useEffect(() => {
    window.addEventListener('message', handleEvents, false)

    return () => window.removeEventListener('message', handleEvents)
  }, [handleEvents])
Then I just capture the events in the handleEvents function that I created by getting the event
e.data?.gdc?.event
b
Hi Luis, Allow me to step in. The fact is that these dashboard events and commands weren't implemented for user telemetry, but as an additional layer of possible customizations over embedding in iframes. The event of opening the scheduled email dialogue is an action that happens in javascript without any redirect. It triggers some backend API calls, but based on these it isn't possible to 100% determine the action that was taken. So in short, there's no easy way to determine if the schedule email button was clicked in the embedded client just by listening to console events. There are few options, but none of them are really straightforward: 1. implement custom button for scheduled emails (as was mentioned) 2. Use 3rd party tool for measuring user activity (afaik they usually work by adding some transparent overlay over the page) 3. Do the implementation through our react SDK dashboard component - it should allow more options and usage of custom code.
🙌 1
l
Hey Boris! I see, thanks for adding. Also thanks @Moises Morales for the previous responses
1