Skip to main content
Logo
There is a newer version of Contensis. Click to find out more and download the latest version.

Query log data

When a page is tracked or data is captured we store logs of the information which can be queried using the API. A basic query for all the records for a contact with a given tracking id would be as follows:

This would query will return a PagedList of ContactLog.

Page List contains the following properties:

Name Description
Items An enumerable list of items
PageSize The page size requested in the query
PageIndex The page index requested in the query
TotalCount The total number of results found

The returned information gives us a tracked page log and explicit data logs, we can also see that we have a total count of records. Paging can be managed by using the PageIndex and PageSize properties of the query request.

Extending the query

Explicit Data

If we are interested in explicit capture we can add extend the query as follows, which returns a collection of ExplicitDataLog:

Implicit Data (TrackedPageLog)

To get a collection of TrackedPageLog items we can use:

Retrieving custom data

In order to retrieve values for a given contact where a custom field has been set we would query as follows:

Query Operators

Operator Example
And
Op.And ( 
Op.EqualTo("first", 1), 
Op.EqualTo("second", 2)
]
This would return any document where first is 1 AND second is 2.
Between
Op.Between("first", 7, 15)
In the above example if our field is between 7 and 15 (inclusive) it would match.
Contains
Op.Contains("stringField", "test")
In the above example if our field contains the word test it would match.
EndsWith
Op.EndsWith("wordField", "ing")

In the above example if our field contains a word ending with ‘ing’ it would match.
EqualTo
Op.EqualTo("first", 1)
Exists
Op.Exists("fieldName", true)
In the above example any document that has a field called fieldName would be returned. You can use a value of false if you want documents that do not contain a given field.
GreaterThan
Op.GreaterThan("first", 7)
GreaterThanOrEqualTo
Op.GreaterThanOrEqualTo("first", 7)
In
Op.Between("first", 1, 7, 15, 22)
In the above example any document that where the field first is equal to 1,7,15 or 22 would be returned.
LessThan
Op.LessThan("first", 7)
LessThanOrEqualTo
Op.LessThanOrEqualTo("first", 7)
Not
Op.Not(Op.EqualTo("first", 7))
The not expects an inner operator so in the above example any document where first is not equal to 7 would be returned.
Or
Op.Or (
 Op.EqualTo("first", 1),
 Op.EqualTo("second", 2)
]
This would return any document where first is 1 OR second is 2.
StartsWith
Op.StartsWith("wordField", "goo")
In the above example if our field contains a word starting with ‘goo’ it would match.