linking a button to a lightbox that has script

Hi. I have added a script to the head section under the Beta analytics and Tracking. I have then added the script under the HTML on a lightbox and it looks good. When they click on the widget button it launches the 3rd party app. All good.
However, to get to the lightbox, they have to click on a button and then click again in the lightbox to run the widget. Is there a way through code to do an onclick event on the button that opens the lightbox and automatically launches the widget code so they are not clicking twice? Hope that makes sense?

That makes sense.
My suggestion is to use postMessage method in the lightbox onReady scope.
Check out this article .
Another solution is to send analytics data using trackEvent() function .
For more information read this .
Please update in your progress.

HI Roi, Ok that was complete gobbledy gook to me! I guess I’m not too good at deciphering the articles.
So on the lightbox I have:
$w.onReady(function () {


#html1 is where i have the code for the widget. I’m guessing that what’s within the () after postmessage is wrong… What instruction are they looking for? What goes into those brackets?