Problem/Motivation

After connecting Drupal with SearchStax and creating multiple profiles, the analytics data doesn't reflect for those individual profiles.

This happens because the "model" parameter isn't being sent in the track/ request payload, which is required to correctly target a specific search profile to store analytics data.

Steps to reproduce

  1. Create a Drupal app and connect to a SearchStax app with the ability to create more than 1 search profile.
  2. Install and enable the SearchStax module on Drupal.
  3. On SearchStax, create a new search profile.
  4. On Drupal, under Configuration > Search and metadata > SearchStax settings, check the boxes which say "Re-route searches through SearchStudio" and "Configure searches via SearchStudio".
  5. Create a Search view and populate content for testing.
  6. Connect the search profile to the Drupal Views by going to the settings for the view, then clicking the query options under Advanced settings section, and selecting the profile you want to test with. Hit Save.
  7. Perform a test search and note the track/ API request payload. To decode the payload, you can go to https://www.base64decode.org/
  8. You should see that the "model" param isn't included in the payload body, which means the analytics data will get stored and reflected under "All Profiles" on the Site Search dashboard, but that specific profile's analytics view would be empty.

Proposed resolution

Pass in the model name in the "model" param of track/ API request payload as specified in the Analytics REST API doc.

Issue fork searchstax-3572035

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kaunaj created an issue. See original summary.

drunken monkey made their first commit to this issue’s fork.

drunken monkey’s picture

Status: Active » Needs review

  • drunken monkey committed 5ab05f3d on 1.x
    fix: #3572035 Fixed missing "model" property in tracking events.
    
    By:...
drunken monkey’s picture

Merged to HEAD, will be tested there.

pavlosdan’s picture

Probably out of scope for this ticket but since analytics is being worked on here thought I'd ask here before opening a new ticket. Similar to how autosuggest key was moved to the search server settings, could we move the analytics URL and key over there as well to accommodate multi-tenant applications?

Please let me know if you'd like me to open a new ticket!

Thanks,
Pavlos

drunken monkey’s picture

Yes, please do create a new ticket for that, let’s discuss there.
I already see a difference, though, in that analytics isn’t directly linked to a server/app – you might want to use a single analytics key for multiple apps, or different analytics keys for different searches on the same app. Therefore, it seems our current system of per-search overrides (even though hidden from the UI in #3586335: Clean up the Settings page, admittedly) might actually be more flexible than per-server settings.

But please do create a new ticket and we’ll discuss what the best solution would be.

drunken monkey’s picture

Status: Needs review » Fixed

Oh, and this is of course long verified and released, so marking as fixed.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.