Forums » Help & Troubleshooting



Code for tracking which checkboxes are checked

Hello,

I'm trying to use clicky.log to find and log which checkboxes on a page are checked. The jquery I am using is:

var group = ':checkbox[name]';
clicky.log(':checkbox', group);

This isn't working.

The checkboxes all share 'presentation' as the first part of name and id, so maybe that needs to be part of the hook.

Thanks

Posted Wed Dec 3 2014 12:53p by srich***


Here's something I use to track every click as soon as it is clicked.

clicky.log( '#dailyDealsFoobar', 'Daily Deals (foobar)', 'click' );

I prefer the above method, however, to only log the checkboxes on a SUBMIT:

$('input[type=checkbox]').each(function () {
if (this.checked) {
console.log($(this).val());
clicky.log( $(this), ’Message to log goes here’, 'click' );
}
});

Posted Wed Dec 3 2014 1:51p by gladiu***


ok I think what I'm not clear on is what is the '#dailyDealsFoobar', 'Daily Deals (foobar)' corresponding to? Is the #dailyDealsFoobar a div id in the html? And 'Daily Deals (foobar)' is the function calling that div?

Sorry I'm fairly new to jquery.

Posted Wed Dec 3 2014 2:24p by srich***


Arg1 - this is the jquery id of the input checkbox (not the div).

Arg2 - this is the custom text you want to display in clicky e.g. "Foobar checkbox click"

Arg3 - you can leave this out as it defaults to 'click'.

Like this: (Click won't let me post actual HTML, so I used parenthesis)

(input type="checkbox" id="dailyDealsFoobar")

And then:

clicky.log( "#dailyDealsFoobar", "Foobar checkbox click", 'click' );

Here's the docs: https://clicky.com/help/customization/manual#log

Posted Wed Dec 3 2014 9:25p by gladiu***


ok awesome. I got that. Still not working tho. My code:

(script)
clicky.log( "#presentation_options1_Level_1_Acquiring_200.jpg", "Presentation1 checkbox click" );
(/script)

According to the docs "href: Required. The URL you want logged for this action." I'm guessing I need an href.

Do you usually use the page URL you want logged?

Posted Thu Dec 4 2014 9:23a by srich***


You must be logged in to your account to post!