[1.0.x] Search Tracking

Created on 11 January 2024, 6 months ago
Updated 12 March 2024, 4 months ago

Description

This module facilitates search tracking for your search form, utilizing form attribute values. Simple and user friendly module, Used to track the data searched in your site's form. When each submission occurs, the data of the form is saved to the database. Drupal views will be utilised for viewing the saved data. The name of the input element and the Form tag id are needed in order for the entered data to be stored and seen.

Screenshots of configuration page attached with this documentation

Module Installation

Go to install page of the module Search Tracking

Configuration

  • Go to the configuration page of the Search Tracking module (/admin/config/search/search-tracking/form-config).
  • Enter the form attributes you want to use to track the searched keywords.
  • In the configuration page, you can choose whether you want to use the form's id or class.
  • Then go to the views page (admin/structure/views). Here you can add your view using the 'Search Tracking' view.
  • You can customize the view as per your requirements like other views you do.

Difference from other modules

  • This module utilizing the form and its attributes to store the data searched in search form.
  • It doesn't have any API configurations, easy to configure and use.
  • It also provides the searched user's IP address. We can get the data using a IP address field in views.
  • Provides support in Drupal 8,9 and 10 versions.

Working process

  • When a user enters data into the specified form, the data is processed using JavaScript and sent to the controller.
  • The JSON data returned in the controller, will be saved to the database with the user's IP address.
  • A view called 'Search Tracking' was established to display the data. It can be used to display data using fields, just like other views.

Project link

https://www.drupal.org/project/search_tracking

📌 Task
Status

Needs work

Component

module

Created by

🇮🇳India Rash Robie

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Rash Robie
  • 🇮🇳India vishal.kadam Mumbai

    Thank you for applying!

    Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.

    The important notes are the following.

    • If you have not done it yet, you should run phpcs --standard=Drupal,DrupalPractice on the project, which alone fixes most of what reviewers would report.
    • For the time this application is open, only your commits are allowed.
    • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application and no other user will be able to opt projects into security advisory policy.
    • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

    To the reviewers

    Please read How to review security advisory coverage applications , Application workflow , What to cover in an application review , and Tools to use for reviews .

    The important notes are the following.

    • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • Reviewers should show the output of a CLI tool only once per application.
    • It may be best to have the applicant fix things before further review.

    For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues .

  • Issue was unassigned.
  • 🇮🇳India rushiraval

    I am changing the issue priority as per issue priorities .

  • Status changed to Needs work 4 months ago
  • 🇮🇳India rushiraval

    solve the phpcs Error
    phpcs --standard=Drupal,DrupalPractice web/modules/contrib/search_tracking/

    FILE: web/modules/contrib/search_tracking/js/formData.js
    -------------------------------------------------------------------------------------------
    FOUND 20 ERRORS AFFECTING 11 LINES
    -------------------------------------------------------------------------------------------
    9 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
    9 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
    14 | ERROR | [x] Expected 1 space before "+"; 0 found
    14 | ERROR | [x] Expected 1 space after "+"; 0 found
    14 | ERROR | [x] Expected 1 space before "+"; 0 found
    14 | ERROR | [x] Expected 1 space after "+"; 0 found
    33 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
    33 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
    38 | ERROR | [x] Expected 1 space before "+"; 0 found
    38 | ERROR | [x] Expected 1 space after "+"; 0 found
    38 | ERROR | [x] Expected 1 space before "+"; 0 found
    38 | ERROR | [x] Expected 1 space after "+"; 0 found
    57 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
    76 | ERROR | [x] Expected 1 newline at end of file; 8 found
    79 | ERROR | [ ] More than 2 empty lines are not allowed
    80 | ERROR | [ ] More than 2 empty lines are not allowed
    81 | ERROR | [ ] More than 2 empty lines are not allowed
    82 | ERROR | [ ] More than 2 empty lines are not allowed
    83 | ERROR | [ ] More than 2 empty lines are not allowed
    83 | ERROR | [x] Additional whitespace found at end of file
    -------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------

    FILE: web/modules/contrib/search_tracking/src/Form/SearchTrackingConfig.php
    --------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 88 ERRORS AND 4 WARNINGS AFFECTING 73 LINES
    --------------------------------------------------------------------------------------------------------------------------------------------
    3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
    5 | ERROR | [x] Doc comment short description must end with a full stop
    12 | WARNING | [x] Unused use statement
    12 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
    16 | ERROR | [x] Function comment short description must start with exactly one space
    16 | ERROR | [x] Doc comment short description must end with a full stop
    19 | ERROR | [x] Opening brace should be on the same line as the declaration
    21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    21 | ERROR | [x] Missing function doc comment
    22 | ERROR | [x] Opening brace should be on the same line as the declaration
    23 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    24 | WARNING | [x] A comma should follow the last multiline array item. Found: 'search_tracking.settings'
    26 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    28 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    31 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    32 | ERROR | [x] Opening brace should be on the same line as the declaration
    33 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    34 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    36 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    39 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    40 | ERROR | [x] Opening brace should be on the same line as the declaration
    41 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    43 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    44 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    45 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    46 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    47 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    47 | ERROR | [ ] The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple lines
    47 | ERROR | [x] Short array syntax must be used to define arrays
    47 | WARNING | [ ] #options values usually have to run through t() for translation
    48 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    50 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    51 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    52 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    53 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    54 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    54 | ERROR | [x] Short array syntax must be used to define arrays
    55 | ERROR | [x] Array indentation error, expected 14 spaces but found 16
    55 | ERROR | [x] Short array syntax must be used to define arrays
    55 | ERROR | [x] Short array syntax must be used to define arrays
    57 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    59 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    60 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    61 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    62 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    63 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    63 | ERROR | [x] Short array syntax must be used to define arrays
    64 | ERROR | [x] Array indentation error, expected 14 spaces but found 16
    64 | ERROR | [x] Short array syntax must be used to define arrays
    64 | ERROR | [x] Short array syntax must be used to define arrays
    66 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    68 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    69 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    70 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    71 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    72 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    72 | ERROR | [x] Short array syntax must be used to define arrays
    73 | ERROR | [x] Array indentation error, expected 14 spaces but found 16
    73 | ERROR | [x] Short array syntax must be used to define arrays
    73 | ERROR | [x] Short array syntax must be used to define arrays
    75 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    77 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    78 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    79 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    80 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    81 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    82 | ERROR | [x] Array indentation error, expected 14 spaces but found 16
    83 | ERROR | [x] Array indentation error, expected 18 spaces but found 20
    89 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    92 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    93 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    95 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    98 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    98 | WARNING | [ ] Possible useless method overriding detected
    99 | ERROR | [x] Opening brace should be on the same line as the declaration
    100 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    101 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    101 | ERROR | [x] Expected 1 blank line after function; 0 found
    102 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    105 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    106 | ERROR | [x] Opening brace should be on the same line as the declaration
    107 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    108 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    108 | ERROR | [x] Expected 1 blank line after function; 0 found
    109 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    112 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    113 | ERROR | [x] Opening brace should be on the same line as the declaration
    114 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    115 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
    116 | ERROR | [x] Object operator not indented correctly; expected 10 spaces but found 12
    122 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    122 | ERROR | [x] Expected 1 blank line after function; 0 found
    --------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 89 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------

    FILE: web/modules/contrib/search_tracking/src/Controller/searchTrackingController.php
    ------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 12 ERRORS AND 8 WARNINGS AFFECTING 16 LINES
    ------------------------------------------------------------------------------------------------------------------------------------------
    6 | WARNING | [x] Unused use statement
    7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\HttpFoundation\JsonResponse.
    8 | WARNING | [x] Unused use statement
    8 | ERROR | [x] When importing a class with "use", do not include a leading \
    9 | WARNING | [x] Unused use statement
    14 | ERROR | [ ] Class name must begin with a capital letter
    16 | ERROR | [x] Missing function doc comment
    18 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    19 | ERROR | [x] Expected 1 space after IF keyword; 0 found
    19 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
    20 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    24 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    24 | ERROR | [x] Whitespace found at end of line
    25 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    33 | ERROR | [ ] Public method name "searchTrackingController::search_tracking" is not in lowerCamel format
    33 | ERROR | [x] Missing function doc comment
    34 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    37 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    42 | ERROR | [x] Expected 1 blank line after function; 0 found
    43 | ERROR | [x] The closing brace for the class must have an empty line before it
    ------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------

    FILE: web/modules/contrib/search_tracking/search_tracking.views.inc
    ---------------------------------------------------------------------------------------------------
    FOUND 31 ERRORS AFFECTING 30 LINES
    ---------------------------------------------------------------------------------------------------
    4 | ERROR | [x] The second line in the file doc comment must be "@file"
    5 | ERROR | [x] There must be no blank lines after the function comment
    8 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    9 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    10 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    11 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    12 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    16 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    17 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    18 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    19 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
    22 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    23 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    24 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    25 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    26 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
    29 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    30 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    31 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    32 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    33 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    35 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    36 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    37 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    39 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    40 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
    43 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    44 | ERROR | [x] Expected 1 newline at end of file; 2 found
    44 | ERROR | [x] Whitespace found at end of line
    ---------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 31 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------

  • 🇮🇳India vishal.kadam Mumbai

    @Rushikesh Raval It is preferable to not use PHPCode_Sniffer for JavaScript files. It would try to apply PHP rules to JavaScript files, even when those are not correct; for example, it would report that NULL must be used, while null, true, and false are used in JavaScript code.

  • 🇮🇳India rushiraval

    @vishal.kadam thank for your guidance. It is noted for future review.

Production build 0.69.0 2024