Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
Share
LinkBack Thread Tools
Old 09-18-2012, 10:31 AM   #1
HyperActive Warrior
War Room Member
 
GowebMkt's Avatar
 
Join Date: Jan 2010
Location: Northern Michigan
Posts: 209
Thanks: 120
Thanked 13 Times in 10 Posts
Default Code for tracking clicks on 'add to cart' button?

Hi,

I have an 'add to cart' button, not using paypal, and would like to track how many times someone clicks on that image button.

The button can be seen on the site, Claim Back Your Ex


Bret

GowebMkt is offline   Reply With Quote
Old 09-18-2012, 01:00 PM   #2
Content Guru
War Room Member
 
TheContentAuthority's Avatar
 
Join Date: Sep 2009
Location: Pittsburgh, PA US
Posts: 982
Thanks: 48
Thanked 242 Times in 221 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to TheContentAuthority
Default Re: Code for tracking clicks on 'add to cart' button?

Gowebmkt,

You could use Google Analytics and track using virtual page views. This requires that you have an account with Google, install the tracking code at least on the page that you are tracking (whole site would be better), and that you add a line of JavaScript code to the link where the button is. Another solution is to use event tracking as virtual page views may skew your page view metric however if you don’t use Analytics for any other data but tracking clicks on that button it won’t really matter.

Here is a video on how to implement,


Hope that helps,

Shawn



We customize your blog, eBook, press release and backlink content with your message.

The Content Authority
TheContentAuthority is online now   Reply With Quote
Old 09-18-2012, 06:38 PM   #3
HyperActive Warrior
War Room Member
 
GowebMkt's Avatar
 
Join Date: Jan 2010
Location: Northern Michigan
Posts: 209
Thanks: 120
Thanked 13 Times in 10 Posts
Default Re: Code for tracking clicks on 'add to cart' button?

I forgot to mention, I do have GA on the site pages.

Ill check out the video for the JS code to use.

Thanks!

GowebMkt is offline   Reply With Quote
Old 09-18-2012, 07:15 PM   #4
Digital Carpenter
War Room Member
 
FirstSocialApps's Avatar
 
Join Date: Aug 2012
Location: Pennsylvania
Posts: 829
Thanks: 159
Thanked 198 Times in 166 Posts
Social Networking View Member's FaceBook Profile 
Default Re: Code for tracking clicks on 'add to cart' button?

If it was me Id do it with JQUERY and PHP

add to image--
onclick="$.post("trackclick.php");"

PHP file: trackclick.php
<?php

$File = "clickcount.txt"; $fh = fopen($File, 'r'); $Clicks = fread($fh, filesize($File)); fclose($fh);

$Clicks=$Clicks+1;

$File = "clickcount.txt"; $fh = fopen($File, 'w') or die("can't open file"); fwrite($fh, $Clicks);
fclose($fh);
?>

FirstSocialApps is online now   Reply With Quote
Old 09-18-2012, 08:08 PM   #5
HyperActive Warrior
War Room Member
 
dwoods's Avatar
 
Join Date: Sep 2012
Location: Ohio, USA
Posts: 140
Thanks: 8
Thanked 35 Times in 31 Posts
Contact Info
Send a message via Skype™ to dwoods
Default Re: Code for tracking clicks on 'add to cart' button?

Here's an excellent article on using google analytics event tracking:
Idiot's Guide to Event Tracking | .eduGuru
This is the way to go!
dwoods is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Bookmarks

Tags
add, button, cart, clicks, code, tracking

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 08:46 AM.