Expand my Community achievements bar.

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.

Simple Event-based PQL question

Avatar

Community Advisor

Hi guys,

I am finally diving a little deeper into writing PQL audiences and have a beginner question.

Let's say I want to create an audience that includes anyone who has seen at least one web page view.

{
  "name": "People with page views",
  "profileInstanceId": "ups",
  "description": "People who have seen the website i.e., have created at least one page view event",
  "type": "SegmentDefinition",
  "expression": {
    "type": "PQL",
    "format": "pql/text",
    "value": "exists(event => event.web.webPageDetails.pageViews.value = 1.0)"
  },
  "schema": {
    "name": "XDM ExperienceEvent"
  },
  "labels": [
    "core/C1"
  ]
}

 

This body gives me an error

* code: "NEBULA-000000-400",
* message: "There is a problem with the input value. Please check your request and try again." 

 

Any idea what's wrong? Also tried a "==" in the condition with the same result.

Cheers from Switzerland!


6 Replies

Avatar

Community Advisor

Hey @bjoern__koth ,

I think the issue is with schema name, can you try "_xdm.context.experienceevent" for this field?

Cheers!

Avatar

Community Advisor

@Harveer_SinghGi1 

hmm also not really.

{
  "name": "People with page views",
  "profileInstanceId": "ups",
  "description": "People who have seen the website i.e., have created at least one page view event",
  "type": "SegmentDefinition",
  "expression": {
    "type": "PQL",
    "format": "pql/text",
    "value": "exists(event => event.web.webPageDetails.pageViews.value = 1.0)"
  },
  "schema": {
    "name": "_xdm.context.experienceevent"
  },
  "labels": [
    "core/C1"
  ]
}
{
    "type": "https://ns.adobe.com/aep/errors/NEBULA-000000-400",
    "title": "Bad Request",
    "status": 400,
    "instance": "/audiences",
    "request-id": "yhM6CWHP67fCMTcbVTSkzcNjvyqmOSwu",
    "errors": {
        "400": [
            {
                "code": "NEBULA-000000-400",
                "message": "There is a problem with the input value. Please check your request and try again."
            }
        ]
    }
}
Cheers from Switzerland!


Avatar

Community Advisor

Hey @bjoern__koth ,

In that case it is most probably related to the expression.value field. Can you try one of these,

"value": "count(web.webpagedetails.pageViews) >= 1" OR
"value": "sum(web.webpagedetails.pageViews.value) >= 1" or
"value": "count(web.webpagedetails.pageViews.value) >= 1"
 
Cheers!

Avatar

Community Advisor

Hi @Harveer_SinghGi1 

 

Nope, all nebula errors xD

By any chance, can you check if any works on your end?

Cheers from Switzerland!


Avatar

Level 3

Hello @bjoern__koth 
this should be the value for PQL/text this is for experienceEvent

"value" : "CHAIN(xEvent, timestamp, [C0: WHAT(web.webPageDetails.pageViews.value = 1.0)])"

for PQL/json

"format": "pql/json",
"value": "{\"nodeType\":\"chain\",\"array\":{\"nodeType\":\"fieldLookup\",\"fieldName\":\"xEvent\",\"object\":{\"nodeType\":\"parameterReference\",\"position\":1}},\"timestampField\":{\"nodeType\":\"lambda\",\"varNames\":[\"v0\"],\"body\":{\"nodeType\":\"fieldLookup\",\"fieldName\":\"timestamp\",\"object\":{\"nodeType\":\"varRef\",\"varName\":\"v0\"}}},\"elements\":[{\"nodeType\":\"element\",\"name\":\"C0\",\"negated\":false,\"what\":{\"nodeType\":\"lambda\",\"varNames\":[\"v0\"],\"body\":{\"nodeType\":\"fnApply\",\"fnName\":\"=\",\"params\":[{\"nodeType\":\"fieldLookup\",\"fieldName\":\"value\",\"object\":{\"nodeType\":\"fieldLookup\",\"fieldName\":\"pageViews\",\"object\":{\"nodeType\":\"fieldLookup\",\"fieldName\":\"webPageDetails\",\"object\":{\"nodeType\":\"fieldLookup\",\"fieldName\":\"web\",\"object\":{\"nodeType\":\"varRef\",\"varName\":\"v0\"}}}}},{\"nodeType\":\"literal\",\"literalType\":\"Double\",\"value\":1.0}]}}}]}"
 
the conversion from PQL/text to PQL/Json can be done using  API
https://developer.adobe.com/experience-platform-apis/references/segmentation/#operation/convertSegme...


Hope this works

Avatar

Level 2

Hey @bjoern__koth 

I suggest using this below PQL expression

"value": "exists event from xEvent where (event.web.webPageDetails.pageViews.value = 1.0)"
I tried this and got 200. Although for some unknown reason, I can neither see the audience in UI nor fetch that audience details using get endpoint. I hope it works for you!

Thanks,
Ganesh Kumar C