Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #242590

    Hello!

    I need to track social buttons, those in header. For a simple link, tracking code looks like this: <a onclick="_gaq.push(['_trackEvent', 'ClickLink', 'Facebook', 'Message']);" href="https://www.facebook.com/michaelvasin" target="_blank">Facebook</a>

    So where do I insert this onclick="_gaq.push(['_trackEvent', 'ClickLink', 'Facebook', 'Message']);" part?

    #243582

    Hey Vermishelle!

    Here is the solution i came up with, Please follow this very carefully.

    1. Find this file helper-social-media.php inside of this folder ENFOLD/includes/
    2. Add this on the line 33 ( after this line var $counter = 1; ) static $social_counter = 0;
    3. Line 53 ( function build_icon() ). after this global $avia_config; add the following
    $search_array = array('facebook','twitter', 'skype', 'pinterest', 'soundcloud');
    //On this one is the key, i’m adding facebook, twitter, …. base on the elements i have added on the enfold options so if you have others add those and remove the ones that you don’t need ‘soudcloud’ for instance
    4. Find this on line 88 roughly
    $html .= "<a {$blank} href='".$icon['social_icon_link']."' ".av_icon_string($icon['social_icon'])." title='".ucfirst($icon['social_icon'])."'></a>";

    5. Replace the above ( 4. ) with this.

     if ( in_array( $search_array[static::$social_counter], $search_array) ) {
    				
    			    $html .= "<a {$blank} href='".$icon['social_icon_link']."' ".av_icon_string($icon['social_icon'])." title='".ucfirst($icon['social_icon'])."' onclick='". "_gaq.push(['_trackEvent', 'ClickLink', '". $search_array[static::$social_counter]."', 'Message']).". "'></a>";
    			   	static::$social_counter++;
    			   	
    
    			}else{
    				$html .= "<a {$blank} href='".$icon['social_icon_link']."' ".av_icon_string($icon['social_icon'])." title='".ucfirst($icon['social_icon'])."'></a>";	
    			} 

    And that is it.

    Regards,
    David

    • This reply was modified 10 years, 9 months ago by David.
    #247921

    It didn’t work for me. I’ll post my login details as a private reply if you din’t mind to check.

    #247922
    This reply has been marked as private.
    #247930

    I changed “vimeo” to “vkontakte” icon, according to this customization https://kriesi.at/support/topic/adding-custom-social-icons/

    Of corse, I changed your $search_array = array('facebook','twitter', 'skype', 'pinterest', 'soundcloud'); to $search_array = array('facebook','VKontakte');

    Anyway, Facebook icon was left untouched, but it doesn’t work as well.

    #248622

    Hi!

    Try to use this code instead:

    
     if ( in_array( $search_array[static::$social_counter], $search_array) ) {
    				
    $html .= "<a {$blank} href='".$icon['social_icon_link']."' ".av_icon_string($icon['social_icon'])." title='".ucfirst($icon['social_icon'])."' onclick='_gaq.push(['_trackEvent', 'ClickLink', '". $search_array[static::$social_counter]."', 'Message'])'></a>";
    			   	static::$social_counter++;
    			   	
    
    			}else{
    				$html .= "<a {$blank} href='".$icon['social_icon_link']."' ".av_icon_string($icon['social_icon'])." title='".ucfirst($icon['social_icon'])."'></a>";	
    			} 
    

    Regards,
    Peter

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