Re: LightBox click detection
| From: | Micky Hulse | Date: | Sun, 16 Jun 2013 22:48:37 +0000 |
| Subject: | Re: LightBox click detection | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321416@lists.php.net to get a copy of this message | ||
On Fri, Jun 14, 2013 at 8:52 AM, Tedd Sperling <tedd@sperling.com> wrote:
> Here's the problem -- I need to count the number of times a user activates a LightBox --
> how do you do that?
If you're using Google Analytics, you can use click tracking:
<https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide>
I recently setup click tracking on lightbox open, close and various
other modal window bits/pieces for a metered pay wall system.
For example, within the lightbox/modal window "open" method:
[code]
// Track this lightbox instance:
window._gaq.push([
'_trackEvent', // Method.
'Paymeter Lightbox', // Group.
'Lightbox OPEN group ' + count_txt, // Append count to "action" text.
count_txt + ' OPEN event' // Prepend count to "label" text.
]);
[/code]
The advantage to using a common tool like analytics is that it's got a
ton of powerful ways to analyze the data.
Not sure the goal of your project, but I thought I would mention.
Cheers,
M