-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSP-160 Search analytics for nosto products sw66 #105
base: develop
Are you sure you want to change the base?
Conversation
} | ||
|
||
$dataSource = $data['dataSource']; | ||
$payload = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it would be a good idea to create an object for the data source within the php-sdk. This would be easier to work with, and obviously would mean that magento etc could reuse the structure of the object and what should be sent etc.
]; | ||
|
||
try { | ||
if ($dataSource === 'search') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use constant for search and category
return new JsonResponse(['status' => 'success']); | ||
} | ||
|
||
return new JsonResponse(['error' => 'Failed to track analytics'], Response::HTTP_INTERNAL_SERVER_ERROR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be a good idea to also include the actual error to the response (so it would be easier for ourselves to see what has failed when debugging merchants store)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that php-sdk should maybe be void, and if something happens or fails throw the exception that would be caught here and then we can actually return the reason of the failure
That also means less code here :)
it would go as
$tracker->track($dataSource, $payload);
return new JsonResponse(['status' => 'success']);
} catch (\Exception $e) {
......
}); | ||
|
||
if (response.ok) { | ||
console.log('Tracking successful', await response.json()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably don't want to see console logs for info in the browser
$dataSource = $data['dataSource']; | ||
$payload = [ | ||
'query' => $data['productNumber'], | ||
'resultId' => $data['resultId'] ?? 'DEMODEMODEMO', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think that should be the unique uuid
|
||
$dataSource = $data['dataSource']; | ||
$payload = [ | ||
'query' => $data['productNumber'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query from what i understand https://nostosolutions.atlassian.net/wiki/spaces/HD/pages/9986605082/Front-end+analytics+ingestion
should be a search value we searched for or the category
body: JSON.stringify({ | ||
dataSource, | ||
productNumber, | ||
productId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this currently isn't enough (we need to know if click happened due to the specific search query or from specific category depending if its search/cm tracking
{% block element_product_listing_col_empty %} | ||
<div class="cms-listing-col col-12"> | ||
{% block element_product_listing_col_empty_alert %} | ||
{% sw_include '@Storefront/storefront/utilities/alert.html.twig' with { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at previous code we had pagination here, so i fonder if thats okay?
No description provided.