Skip to content

Instantly share code, notes, and snippets.

(function ()
function getLastEvent(sessions) {
var lastSession = sessions[sessions.length - 1];
var lastEvent = lastSession.events[lastSession.events.length - 1];
return lastEvent;
}
var lastEvent = getLastEvent(guest.sessions);
return lastEvent.type;
})();
(function ()
var sessionRef;
if (entity) {
sessionRef = entity.ref;
}
var sessionStatus = "";
for (var i = 0; i < guest.sessions.length; i++) {
var session = guest.sessions[i];
if (session.ref === sessionRef) {
(function () {
function getNumberOfEvents(sessions, eventType) {
var numberOfEvents = 0;
for (var i = 0; i < sessions.length; i++) {
var session = sessions[i];
for (var j = 0; j < session.events.length; j++) {
var event = session.events[j];
if (event.type === eventType) {
numberOfEvents++;
}
USE [database_name] -- replace with your Reporting DB name
GO
-- [Fact_MvTesting] contains aggregated number of visits, engagement value, bounces, etc. for each test variant
-- TestSetId is ID of test definition item and TestValues represent each of the test variants
SELECT *
FROM [dbo].[Fact_MvTesting]
WHERE TestSetId = 'DB071F98-C2CE-4DBB-8873-2E378F88CEB4' -- replace with your test ID
@geann
geann / 2. ContactFacets.sql
Last active May 23, 2022 12:33
Script to check TestCombinations contact facet
USE [database_name] -- replace with your Shard DB name, you may need to check all your Shard DBs
GO
SELECT *
FROM [xdb_collection].[ContactFacets]
WHERE ContactId = '0E3CC254-C440-0000-0000-062C9FE15922' -- replace with your contact ID
AND FacetKey = 'TestCombinations'
@geann
geann / 1. Interactions.sql
Last active April 12, 2022 13:01
Script to get interactions
USE [database_name] -- replace with your Shard DB name, you may need to check all your Shard DBs
GO
SELECT TOP(100) * --always limit number of results, especially if you Shard DB is large
FROM [xdb_collection].[Interactions]
WHERE ContactId = '0E3CC254-C440-0000-0000-062C9FE15922' -- replace with your contact ID if it is known
AND StartDateTime > '2022-01-01 12:00' -- replace with your date and time, keep the time range as small as possible
-- be careful when adding more fields to the WHERE condition because Interactions table has only 2 indexes and searching for large number of interactions can be slow