Archived topic
GetSiteControl JavaScript
7 replies · Started by Cheryl on February 19, 2018
Hi Guys
Can anyone advise on best practice for launching a javascript via a button or menu link, here's the snippet from GetSite Control Example:
<script>
function showWidget(){
_gscq.push(['show', 82297]);
}
</script>
Regards
Nigel
HiTom,
Might be a little beyond me at the moment, would this help (I saw you recommended this).
https://generatepress.com/forums/topic/embed-script-form/
Cheryl
For example, here's your button:
<a class="button launch-widget" href="#">My button</a>
Here's your javascript:
<script>
jQuery( '.launch-widget' ).on( 'click', function(e) {
e.preventDefault();
_gscq.push(['show', 82297]);
} );
</script>
Hi Cheryl,
Ksenia from GetSiteControl e-mailed me and provided this link that should solve your problem:
https://getsitecontrol.com/howto/developer-documentation/how-display-widgets-based-your-site-logic-eg-button-clicks/
Maybe give them a shout if you have further questions on this.
Thanks Guys
Brilliant, stupid question where do I put the script?
Cheryl
Problem solved :-)
Glad you figured out!