wpcom-customizer.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * WordPress.com-specific.
  3. * Track the clicks for certain theme features.
  4. */
  5. ( function() {
  6. wp.customize.bind( 'ready', function() {
  7. logoResize = document.querySelector( '#customize-control-logo_size input[type=range]' );
  8. callToActionSection = document.getElementById( 'accordion-section-radcliffe_2_hero_area' );
  9. contactInfoSection = document.getElementById( 'accordion-section-radcliffe_2_contact_info' );
  10. stylePacksSection = document.getElementById( 'accordion-section-style_pack_theme_options' );
  11. callToActionSectionButton = callToActionSection.getElementsByTagName( 'h3' )[0];
  12. contactInfoSectionButton = contactInfoSection.getElementsByTagName( 'h3' )[0];
  13. stylePacksSectionButton = stylePacksSection.getElementsByTagName( 'h3' )[0];
  14. // Tracking for Logo Resizer clicks.
  15. if ( logoResize ) {
  16. logoResize.addEventListener( 'click', function() {
  17. window._tkq = window._tkq || [];
  18. window._tkq.push( [
  19. 'recordEvent',
  20. 'wpcom_radcliffe2_customize_logo_resize_click',
  21. { status: 'clicked' }
  22. ] );
  23. } );
  24. }
  25. // Tracking for Call to Action clicks.
  26. if ( callToActionSection ) {
  27. if ( callToActionSectionButton ) {
  28. callToActionSectionButton.addEventListener( 'click', function() {
  29. window._tkq = window._tkq || [];
  30. window._tkq.push( [
  31. 'recordEvent',
  32. 'wpcom_radcliffe2_customize_call_to_action_click',
  33. { status: 'clicked' }
  34. ] );
  35. } );
  36. }
  37. }
  38. // Tracking for Contact Info clicks.
  39. if ( contactInfoSection ) {
  40. if ( contactInfoSectionButton ) {
  41. contactInfoSectionButton.addEventListener( 'click', function() {
  42. window._tkq = window._tkq || [];
  43. window._tkq.push( [
  44. 'recordEvent',
  45. 'wpcom_radcliffe2_customize_contact_info_click',
  46. { status: 'clicked' }
  47. ] );
  48. } );
  49. }
  50. }
  51. // Tracking for Style Packs clicks.
  52. if ( stylePacksSection ) {
  53. if ( stylePacksSectionButton ) {
  54. stylePacksSectionButton.addEventListener( 'click', function() {
  55. window._tkq = window._tkq || [];
  56. window._tkq.push( [
  57. 'recordEvent',
  58. 'wpcom_radcliffe2_customize_style_packs_click',
  59. { status: 'clicked' }
  60. ] );
  61. } );
  62. }
  63. }
  64. } );
  65. } ).call( this );