[Resolved] GetSiteControl JavaScript

Home Forums Support [Resolved] GetSiteControl JavaScript

Home Forums Support GetSiteControl JavaScript

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #500097
    Cheryl

    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

    #500395
    Tom
    Lead Developer
    Lead Developer

    Hi Cheryl,

    This should help: http://api.jquery.com/on/#event-handler

    Let me know ๐Ÿ™‚

    #501410
    Cheryl

    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

    #501632
    Tom
    Lead Developer
    Lead Developer

    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>
    #502979
    Leo
    Staff
    Customer Support

    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.

    #506310
    Cheryl

    Thanks Guys

    Brilliant, stupid question where do I put the script?

    Cheryl

    #506317
    Cheryl

    Problem solved ๐Ÿ™‚

    #506449
    Leo
    Staff
    Customer Support

    Glad you figured out!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.