CreateSegmentModel
  • 2 Minutes to read
  • Dark
    Light
  • PDF

CreateSegmentModel

  • Dark
    Light
  • PDF

Article summary

Creates a table of segment IDs, counts and filtered counts from the current campaign segment list

KeyValue(s)Description
method"CreateSegmentModel"Creates a table of segment IDs, counts and filtered counts from the current campaign segment list
segments[]
Optional.  If not present, all segments in the system will be analysed (i.e., all segments listed in the Audiences or Campaigns interface)
Provide a list of segments IDs to include in the analysis:
[
10001,
10002,
10003
]

NOTE: A list of segment IDs can be obtained from the Campaign | Audiences report. Filter the grid to show the required segments, and then use the Copy/Paste functionality to transfer segment IDs into the AnalyseSegments API.
NOTE: Only one of segments or segmentFilter can be used.
  "segments": [    10846,    10847,    10848,    10849,    10850,    10851,    10852,    10853,    10854,    10855  ],

segmentFilter{}
Optional.
Only includes segments that meet criteria.

Required input:
  • field: full name of field containing segment IDs  (Note: This table can be created from another AnalyseSegments call or from CreateSegmentModel)
  • dataSet{} : dataSet JSON for the query that will select the Ids.
NOTE: Only one of segments or segmentFilter can be used.

"segmentFilter": {    "field": "DailyLoad.Id",    "dataSet": {      "logic": "or",      "name": "DataSet",      "strict": true,      "set": [        {          "logic": "and",          "stype": "FIELD",          "entity": {            "type": "field",            "name": "DailyLoad.records",            "table": "DailyLoad",            "valueFilter": []          },          "op": ">=",          "values": [            "200000"          ]        }      ]    }  },

table"tablename"Required.  
Target table for output results.  Table must not already exist
targetDataSets[][
{Dataset1Definition},
{Dataset2Definition},
{Dataset3Definition} 
]
Required.  Target datasets to use when calculating overlaps.
A minimum of 1 target dataset must be included.
Target datasets can be added either by dragging and dropping a dataset collection onto the JSON window, or by dragging and dropping a dataset.

NOTE: All target datasets must be on the primary contact table.  (The Primary Contact Table is a DataJet table containing at minimum Hash-Keys and their matching Integer-Keys.  It is created by loading the Master Hash-Key File generated by ProcessSegments.  See Campaign Prototype: How to make a system campaign enabled for further details).
To use data from other tables, first copy the required fields to the primary contact table using either CopyUp or CopyDown.

A maximum of 16 target datasets can be processed in each call to Analyse Segments
project

Output

Example

{
  "method": ";CreateSegmentModel",
  "table": "MySegmentSelectorTable",
  "targetDataSets": [
    {
      "logic": "or",
      "name": "Alaska",
      "strict": true,
      "set": [
        {
          "logic": "or",
          "stype": "FIELD",
          "entity": {
            "type": "field",
            "name": "DATA_EYE_FULL.address_region",
            "table": "DATA_EYE_FULL",
            "valueFilter": []
          },
          "op": "=",
          "values": [
            "Alaska"
          ]
        }
      ]
    },
    {
      "logic": "or",
      "name": "California",
      "strict": true,
      "set": [
        {
          "logic": "or",
          "stype": "FIELD",
          "entity": {
            "type": "field",
            "name": "DATA_EYE_FULL.address_region",
            "table": "DATA_EYE_FULL",
            "valueFilter": []
          },
          "op": "=",
          "values": [
            "California"
          ]
        }
      ]
    },
    {
      "logic": "or",
      "name": "Connecticut",
      "strict": true,
      "set": [
        {
          "logic": "or",
          "stype": "FIELD",
          "entity": {
            "type": "field",
            "name": "DATA_EYE_FULL.address_region",
            "table": "DATA_EYE_FULL",
            "valueFilter": []
          },
          "op": "=",
          "values": [
            "Connecticut"
          ]
        }
      ]
    },
    {
      "logic": "or",
      "name": "Delaware",
      "strict": true,
      "set": [
        {
          "logic": "or",
          "stype": "FIELD",
          "entity": {
            "type": "field",
            "name": "DATA_EYE_FULL.address_region",
            "table": "DATA_EYE_FULL",
            "valueFilter": []
          },
          "op": "=",
          "values": [
            "Delaware"
          ]
        }
      ]
    },
    {
      "logic": "or",
      "name": "Florida",
      "strict": true,
      "set": [
        {
          "logic": "or",
          "stype": "FIELD",
          "entity": {
            "type": "field",
            "name": "DATA_EYE_FULL.address_region",
            "table": "DATA_EYE_FULL",
            "valueFilter": []
          },
          "op": "=",
          "values": [
            "Florida"
          ]
        }
      ]
    },
    {
      "logic": "or",
      "name": "North Carolina",
      "strict": true,
      "set": [
        {
          "logic": "or",
          "stype": "FIELD",
          "entity": {
            "type": "field",
            "name": "DATA_EYE_FULL.address_region",
            "table": "DATA_EYE_FULL",
            "valueFilter": []
          },
          "op": "=",
          "values": [
            "North Carolina"
          ]
        }
      ]
    },
    {
      "logic": "or",
      "name": "North Dakota",
      "strict": true,
      "set": [
        {
          "logic": "or",
          "stype": "FIELD",
          "entity": {
            "type": "field",
            "name": "DATA_EYE_FULL.address_region",
            "table": "DATA_EYE_FULL",
            "valueFilter": []
          },
          "op": "=",
          "values": [
            "North Dakota"
          ]
        }
      ]
    }
  ],
  "project": "SBM_AnalyseSegments_Demo",
  "description": "Create simple data - All segments, with targeDataSets"
}





Was this article helpful?