Skip to content
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

feat(specs): add authenticatedUserToken and Identify to insights #2151

Merged
merged 9 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/.cache_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.97
0.0.98
2 changes: 2 additions & 0 deletions specs/insights/common/schemas/AddedToCartObjectIDs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
2 changes: 2 additions & 0 deletions specs/insights/common/schemas/ClickedFilters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
2 changes: 2 additions & 0 deletions specs/insights/common/schemas/ConvertedFilters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
2 changes: 2 additions & 0 deletions specs/insights/common/schemas/ConvertedObjectIDs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
5 changes: 5 additions & 0 deletions specs/insights/common/schemas/EventAttributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ userToken:
> **Note**: Never include personally identifiable information in user tokens.
example: test-user-1

authenticatedUserToken:
type: string
description: User token for authenticated users.
example: c6a52c02-d0c7-4b53-8ce3-2b8fd202f3f9

timestamp:
type: integer
format: int64
Expand Down
1 change: 1 addition & 0 deletions specs/insights/common/schemas/EventsItems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ oneOf:
- $ref: './AddedToCartObjectIDs.yml'
- $ref: './PurchasedObjectIDs.yml'
- $ref: './PurchasedObjectIDsAfterSearch.yml'
- $ref: './Identify.yml'
16 changes: 16 additions & 0 deletions specs/insights/common/schemas/Identify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type: object
title: Identify user
description: |
The identify event is a signal for Insights to process all events coming from 'userToken' as if they were from 'authenticatedUserToken'.
properties:
eventType:
$ref: './IdentifyEvent.yml'
default: identify
userToken:
$ref: './EventAttributes.yml#/userToken'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventType
- userToken
- authenticatedUserToken
2 changes: 2 additions & 0 deletions specs/insights/common/schemas/IdentifyEvent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type: string
enum: [identify]
2 changes: 2 additions & 0 deletions specs/insights/common/schemas/PurchasedObjectIDs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
2 changes: 2 additions & 0 deletions specs/insights/common/schemas/ViewedFilters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
2 changes: 2 additions & 0 deletions specs/insights/common/schemas/ViewedObjectIDs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ properties:
$ref: './EventAttributes.yml#/userToken'
timestamp:
$ref: './EventAttributes.yml#/timestamp'
authenticatedUserToken:
$ref: './EventAttributes.yml#/authenticatedUserToken'
required:
- eventName
- eventType
Expand Down
37 changes: 37 additions & 0 deletions tests/CTS/methods/requests/insights/pushEvents.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"eventName": "Product Clicked",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -30,6 +31,7 @@
"eventName": "Product Clicked",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -54,6 +56,7 @@
"eventName": "Product Purchased",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -66,6 +69,7 @@
"eventName": "Product Detail Page Viewed",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -84,6 +88,7 @@
"eventName": "Product Purchased",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -96,6 +101,7 @@
"eventName": "Product Detail Page Viewed",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -115,6 +121,7 @@
"eventName": "Product Purchased",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -134,6 +141,7 @@
"eventName": "Product Purchased",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -154,6 +162,7 @@
"eventName": "Product Detail Page Viewed",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -172,6 +181,7 @@
"eventName": "Product Detail Page Viewed",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -193,6 +203,7 @@
"index": "products",
"queryID": "43b15df305339e827f0ac0bdc5ebcaa7",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand Down Expand Up @@ -226,6 +237,7 @@
"index": "products",
"queryID": "43b15df305339e827f0ac0bdc5ebcaa7",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
Expand All @@ -248,5 +260,30 @@
]
}
}
},
{
"testName": "Identify",
"parameters": {
"events": [
{
"eventType": "identify",
"userToken": "anonymous-1",
"authenticatedUserToken": "authenticated-1"
}
]
},
"request": {
"path": "/1/events",
"method": "POST",
"body": {
"events": [
{
"eventType": "identify",
"userToken": "anonymous-1",
"authenticatedUserToken": "authenticated-1"
}
]
}
}
}
]
Loading