-
AuthorPosts
-
March 25, 2014 at 9:27 am #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?March 26, 2014 at 11:47 pm #243582Hey 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.
April 6, 2014 at 4:17 pm #247921It didn’t work for me. I’ll post my login details as a private reply if you din’t mind to check.
April 6, 2014 at 4:25 pm #247922This reply has been marked as private.April 6, 2014 at 4:50 pm #247930I 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.
April 8, 2014 at 6:35 am #248622Hi!
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 -
AuthorPosts
- You must be logged in to reply to this topic.