-3

I have going to add the below code in the revolution slider in the WordPress website from adding to the "Html/Text" Layer. Output showing the inner sider but not showing the user interface. After saving the code that is converted in the NoScript tag.

Note: My motive is that how can I add " onClick="goog_report_conversion ('https://apps.apple.com/us/app/people-app/id1335211174')" on image click.

Amit Kumar
  • 21
  • 4

1 Answers1

0

there are a few step to with this.

  1. Setup your Google Analytics account for your site.

  2. Hyperlink your Slides and/or Layers.

  3. Add the "ga-button" class to your hyperlinks.

  4. Add the following script to your slider's Custom JavaScript section.

    jQuery('body').on('click', '.ga-button', function() {
    
        var $this = jQuery(this),
        data  = $this.attr('data-link') || $this.attr('href');
    
        if(!data) {
    
            data = $this.attr('data-actions');
            if(data) data = data[0].url;
            if(!data) data = $this.attr('id');
    
        }
    
        gtag('event', 'click', { event_category: 'outbound', event_action: 'click', event_label: data});
    
    });
    

Track All Slide Changes:

jQuery(window).on('load', function() {

    jQuery('.rev_slider').each(function() {

        var ids = jQuery(this).attr('id').split('rev_slider_')[1].split('_')[0],
        api  = eval('revapi' + ids);

        api.on('revolution.slide.onchange', function(e, data) {

            var data = 'Slider ' + ids + ' changed to slide #' + data.slideIndex;
            gtag('event', 'click', { event_category: 'outbound', event_action: 'click', event_label: data});

        });

    });

});

All done Enjoy;

Stender
  • 2,446
  • 1
  • 14
  • 22