<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>BlueOwlCreative  &#187;  Topic: Google Analytics Tracking Event Code Doesn&#039;t Work With Button</title>
		<atom:link href="http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/feed/" rel="self" type="application/rss+xml" />
		<link>http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/feed/</link>
		<description></description>
		<pubDate>Fri, 17 Jul 2026 14:15:26 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.5.3-5249</generator>
		<language>en-US</language>

		
														
					
				<item>
					<guid>http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/#post-21604</guid>
					<title><![CDATA[Google Analytics Tracking Event Code Doesn&#039;t Work With Button]]></title>
					<link>http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/#post-21604</link>
					<pubDate>Wed, 07 Jan 2015 08:31:14 +0000</pubDate>
					<dc:creator>paulgian</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>I&#8217;m trying to use Google Analytics to track events when users click on the button. How do I add the code correctly? I tried this but it doesn&#8217;t work.</p>
<p>[button href="http://testing.com" rel="nofollow" target="_blank" onClick="ga('send', 'event', { eventCategory: 'affiliate', eventAction: 'vendorname'});" css_classes="button_hilite _button"]Get More Details[/button]</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/#post-21606</guid>
					<title><![CDATA[Reply To: Google Analytics Tracking Event Code Doesn&#039;t Work With Button]]></title>
					<link>http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/#post-21606</link>
					<pubDate>Thu, 08 Jan 2015 15:40:17 +0000</pubDate>
					<dc:creator>BlueOwl</dc:creator>

					<description>
						<![CDATA[
						<p>Hi to achieve this you may want to extend the button shortcode a bit. Edit your includes/shortcodes.php, find this method:</p>
<pre><code>function shortcode_boc_button($atts, $content = null){

	$atts = shortcode_atts(
			array(
				&#039;css_classes&#039; =&gt; &#039;&#039;,
				&#039;href&#039; =&gt; &#039;&#039;,
				&#039;target&#039; =&gt; &#039;&#039;,
			), $atts);	
	$target = ($atts[&#039;target&#039;] ? &quot; target=&#039;&quot;.$atts[&#039;target&#039;].&quot;&#039;&quot; : &#039;&#039;);
    return &#039;&lt;a href=&quot;&#039;.$atts[&quot;href&quot;].&#039;&quot; class=&quot;button &#039;.$atts[&quot;css_classes&quot;].&#039;&quot; &#039;.$target.&#039;&gt;&#039;.do_shortcode_boc($content).&#039;&lt;/a&gt;&#039;;  
}</code></pre>
<p>Let&#8217;s add the new param, say onclick:</p>
<pre><code>function shortcode_boc_button($atts, $content = null){

	$atts = shortcode_atts(
			array(
				&#039;css_classes&#039; =&gt; &#039;&#039;,
				&#039;href&#039; =&gt; &#039;&#039;,
				&#039;target&#039; =&gt; &#039;&#039;,
				&#039;onclick&#039; =&gt; &#039;&#039;,
			), $atts);	
	$target = ($atts[&#039;target&#039;] ? &quot; target=&#039;&quot;.$atts[&#039;target&#039;].&quot;&#039;&quot; : &#039;&#039;);
        $onclick = ($atts[&#039;onclick&#039;] ? &quot; onclick=\&quot;&quot;.$atts[&#039;onclick&#039;].&quot;\&quot;&quot; : &#039;&#039;);

    return &#039;&lt;a href=&quot;&#039;.$atts[&quot;href&quot;].&#039;&quot; $onclick class=&quot;button &#039;.$atts[&quot;css_classes&quot;].&#039;&quot; &#039;.$target.&#039;&gt;&#039;.do_shortcode_boc($content).&#039;&lt;/a&gt;&#039;;  
}</code></pre>
<p>Now try your code like so:</p>
<p><code>[button href=&quot;http://testing.com&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot; onClick=&quot;ga(&#039;send&#039;, &#039;event&#039;, { eventCategory: &#039;affiliate&#039;, eventAction: &#039;vendorname&#039;});&quot; css_classes=&quot;button_hilite _button&quot;]Get More Details[/button]</code></p>
<p>and let me know if it works for you. <img src="http://blueowlcreative.com/support_wp/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> </p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/#post-28179</guid>
					<title><![CDATA[Reply To: Google Analytics Tracking Event Code Doesn&#039;t Work With Button]]></title>
					<link>http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/#post-28179</link>
					<pubDate>Wed, 20 Apr 2016 11:59:52 +0000</pubDate>
					<dc:creator>ksimmerman</dc:creator>

					<description>
						<![CDATA[
						<p>If I update my button shortcode will I lose this update if/when I update my theme when you post theme updates?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/#post-28185</guid>
					<title><![CDATA[Reply To: Google Analytics Tracking Event Code Doesn&#039;t Work With Button]]></title>
					<link>http://blueowlcreative.com/support_wp/forums/topic/google-analytics-tracking-event-code-doesnt-work-with-button/#post-28185</link>
					<pubDate>Thu, 21 Apr 2016 08:20:20 +0000</pubDate>
					<dc:creator>BlueOwl</dc:creator>

					<description>
						<![CDATA[
						<p>Yes&#8230; <img src="http://blueowlcreative.com/support_wp/wp-includes/images/smilies/icon_neutral.gif" alt=":|" class="wp-smiley" /><br />
Just keep a copy of it in case you update so you know what to needs to be changed.</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

