{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Time-Based Filters - Attribute & Behavior","description":"Learn how to create attribute and behavior filters based on timestamps for segment creation in Audience Studio using the Audience API.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"time-based-filters---attribute--behavior","__idx":0},"children":["Time-Based Filters - Attribute & Behavior"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Because marketers want to define segments based on a timestamp, you might need to create attribute and behavior filters based on time when creating segments. You can use time filters in conjunction with other attributes or behaviors."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Examples of segments include:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Profiles whose order date was in the past 3 months"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Profiles who visited the website between 1-2 years ago"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Profiles whose renewal date is within 30 days"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-to-set-up-time-filters","__idx":1},"children":["How to Set up Time Filters"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"data-type-supported","__idx":2},"children":["Data Type Supported"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Only long type columns (Unix time) are supported as time filters. For example, your long type column might look like this:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["“user_registrations”.”registered_at”"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"steps-to-configure-time-filter","__idx":3},"children":["Steps to Configure Time Filter"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Determine which columns in a parent segment should contain timestamps. Communicate this information to a Customer Support representative."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Convert any string-based timestamps to Unix Time (long type)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use the following API calls to configure column types."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use API to change column type from long to timestamp type"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Perform a GET request on a parent segment where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["attribute"]},"/",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["behavior"]}," column/s with Unix timestamp format data is present and time filter usage is intended."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","data-title":"Sample Request","header":{"title":"Sample Request","controls":{"copy":{}}},"source":"curl -I -X GET \\\nhttps://api-cdp.treasuredata.com/audiences/<master segment id>\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"jsonc","data-title":"Sample Response","header":{"title":"Sample Response","controls":{"copy":{}}},"source":"{\n    \"id\": \"43356\",\n    \"name\": \"ms_hive2_tez\",\n    \"description\": \"\",\n    \"scheduleType\": \"none\",\n    \"scheduleOption\": null,\n    \"timezone\": \"UTC\",\n    \"createdAt\": \"2021-05-24T20:36:29.369Z\",\n    \"updatedAt\": \"2021-06-03T17:48:34.969Z\",\n    \"createdBy\": {\n        \"id\": \"23\",\n        \"name\": \"aaaaaaa\"\n    },\n    \"updatedBy\": {\n        \"id\": \"23\",\n        \"name\": \"aaaaaaa\"\n    },\n    \"matrixUpdatedAt\": \"2021-06-04T00:56:25.526Z\",\n    \"workflowHiveOnly\": false,\n    \"hiveEngineVersion\": \"0.13\",\n    \"hivePoolName\": null,\n    \"prestoPoolName\": null,\n    \"population\": 1004,\n    \"rootFolderId\": \"103977\",\n    \"master\": {\n        \"parentDatabaseName\": \"cdp_dashboard_test_db1\",\n        \"parentTableName\": \"master\"\n    },\n    \"attributes\": [\n        {\n            \"audienceId\": \"43356\",\n            \"id\": \"45709\",\n            \"name\": \"payment\",\n            \"type\": \"number\",\n            \"parentDatabaseName\": \"cdp_dashboard_test_db1\",\n            \"parentTableName\": \"purchases\",\n            \"parentColumn\": \"payment\",\n            \"parentKey\": \"td_client_id\",\n            \"foreignKey\": \"td_client_id\",\n            \"matrixColumnName\": \"payment\"\n        },\n        {\n            \"audienceId\": \"43356\",\n            \"id\": \"45710\",\n            \"name\": \"purchase_time\",        // Attribute column with Unix timestamp format data\n            \"type\": \"number\",                  //   It will be of number datatype\n            \"parentDatabaseName\": \"cdp_dashboard_test_db1\",\n            \"parentTableName\": \"purchases\",\n            \"parentColumn\": \"purchase_time\",\n            \"parentKey\": \"td_client_id\",\n            \"foreignKey\": \"td_client_id\",\n            \"matrixColumnName\": \"purchase_time\"\n        }\n    ],\n    \"behaviors\": [\n        {\n            \"audienceId\": \"43356\",\n            \"id\": \"31836\",\n            \"name\": \"behaviors\",\n            \"parentDatabaseName\": \"cdp_dashboard_test_db1\",\n            \"parentTableName\": \"pageview_with_date_column\",\n            \"parentKey\": \"td_client_id\",\n            \"foreignKey\": \"td_client_id\",\n            \"matrixDatabaseName\": \"cdp_audience_43356\",\n            \"matrixTableName\": \"behavior_pageview_with_date_column\",\n            \"allColumns\": false,                 //     Make sure on Master Segment Config user selects\n            // each behavior individually instead of selecting all,\n            // So they can easily update type for the behavior (for\n            // which time filter usage is intended)\n            \"scheduleType\": \"none\",\n            \"scheduleOption\": null,\n            \"schema\": [\n                {\n                    \"name\": \"category\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"category\",\n                    \"matrixColumnName\": \"category\"\n                },\n                {\n                    \"name\": \"datetime_viewed\", // Behavior column with Unix timestamp format data\n                    \"type\": \"number\",  // It will be of number datatype\n                    \"parentColumn\": \"datetime_viewed\",\n                    \"matrixColumnName\": \"datetime_viewed\"\n                },\n                {\n                    \"name\": \"product_name\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"product_name\",\n                    \"matrixColumnName\": \"product_name\"\n                },\n                {\n                    \"name\": \"td_browser\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"td_browser\",\n                    \"matrixColumnName\": \"td_browser\"\n                },\n                {\n                    \"name\": \"td_client_id\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"td_client_id\",\n                    \"matrixColumnName\": \"td_client_id\"\n                },\n                {\n                    \"name\": \"td_os\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"td_os\",\n                    \"matrixColumnName\": \"td_os\"\n                },\n                {\n                    \"name\": \"td_global_id\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"td_global_id\",\n                    \"matrixColumnName\": \"td_global_id\"\n                }\n            ]\n        }\n    ]\n}\n","lang":"jsonc"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To get a time filter to use for the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["attribute"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["behavior"]}," highlighted above, run the GET /audiences call, then edit the response object and change the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["type"]}," for the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["attribute"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["behavior"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["timestamp"]},". Then use the edited response object as the request object for the the PUT /audiences call."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","data-title":"Sample Request","header":{"title":"Sample Request","controls":{"copy":{}}},"source":"curl -I -X PUT \\\nhttps://api-cdp.treasuredata.com/audiences/<master segment id>\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","data-title":"GET API Response","header":{"title":"GET API Response","controls":{"copy":{}}},"source":"{\n    \"id\": \"43356\",\n    \"name\": \"ms_hive2_tez\",\n    \"description\": \"\",\n    \"scheduleType\": \"none\",\n    \"scheduleOption\": null,\n    \"timezone\": \"UTC\",\n    \"createdAt\": \"2021-05-24T20:36:29.369Z\",\n    \"updatedAt\": \"2021-06-03T17:48:34.969Z\",\n    \"createdBy\": {\n        \"id\": \"23\",\n        \"name\": \"aaaaaaa\"\n    },\n    \"updatedBy\": {\n        \"id\": \"23\",\n        \"name\": \"aaaaaaa\"\n    },\n    \"matrixUpdatedAt\": \"2021-06-04T00:56:25.526Z\",\n    \"workflowHiveOnly\": false,\n    \"hiveEngineVersion\": \"0.13\",\n    \"hivePoolName\": null,\n    \"prestoPoolName\": null,\n    \"population\": 1004,\n    \"rootFolderId\": \"103977\",\n    \"master\": {\n        \"parentDatabaseName\": \"cdp_dashboard_test_db1\",\n        \"parentTableName\": \"master\"\n    },\n    \"attributes\": [\n        {\n            \"audienceId\": \"43356\",\n            \"id\": \"45709\",\n            \"name\": \"payment\",\n            \"type\": \"number\",\n            \"parentDatabaseName\": \"cdp_dashboard_test_db1\",\n            \"parentTableName\": \"purchases\",\n            \"parentColumn\": \"payment\",\n            \"parentKey\": \"td_client_id\",\n            \"foreignKey\": \"td_client_id\",\n            \"matrixColumnName\": \"payment\"\n        },\n        {\n            \"audienceId\": \"43356\",\n            \"id\": \"45710\",\n            \"name\": \"purchase_time\",\n            \"type\": \"timestamp\",\n            \"parentDatabaseName\": \"cdp_dashboard_test_db1\",\n            \"parentTableName\": \"purchases\",\n            \"parentColumn\": \"purchase_time\",\n            \"parentKey\": \"td_client_id\",\n            \"foreignKey\": \"td_client_id\",\n            \"matrixColumnName\": \"purchase_time\"\n        }\n    ],\n    \"behaviors\": [\n        {\n            \"audienceId\": \"43356\",\n            \"id\": \"31836\",\n            \"name\": \"behaviors\",\n            \"parentDatabaseName\": \"cdp_dashboard_test_db1\",\n            \"parentTableName\": \"pageview_with_date_column\",\n            \"parentKey\": \"td_client_id\",\n            \"foreignKey\": \"td_client_id\",\n            \"matrixDatabaseName\": \"cdp_audience_43356\",\n            \"matrixTableName\": \"behavior_pageview_with_date_column\",\n            \"allColumns\": false,\n            \"scheduleType\": \"none\",\n            \"scheduleOption\": null,\n            \"schema\": [\n                {\n                    \"name\": \"category\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"category\",\n                    \"matrixColumnName\": \"category\"\n                },\n                {\n                    \"name\": \"datetime_viewed\",\n                    \"type\": \"timestamp\",\n                    \"parentColumn\": \"datetime_viewed\",\n                    \"matrixColumnName\": \"datetime_viewed\"\n                },\n                {\n                    \"name\": \"product_name\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"product_name\",\n                    \"matrixColumnName\": \"product_name\"\n                },\n                {\n                    \"name\": \"td_browser\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"td_browser\",\n                    \"matrixColumnName\": \"td_browser\"\n                },\n                {\n                    \"name\": \"td_client_id\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"td_client_id\",\n                    \"matrixColumnName\": \"td_client_id\"\n                },\n                {\n                    \"name\": \"td_os\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"td_os\",\n                    \"matrixColumnName\": \"td_os\"\n                },\n                {\n                    \"name\": \"td_global_id\",\n                    \"type\": \"string\",\n                    \"parentColumn\": \"td_global_id\",\n                    \"matrixColumnName\": \"td_global_id\"\n                }\n            ]\n        }\n    ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now the user should be able to use time filters on the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["attribute"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["purchase_time"]}," and the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["behavior"]},"  ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["datetime_viewed"]}," on Audience Studio for the same parent segment (make sure the parent segment has been moved from Audience Studio Legacy)."]}]},"headings":[{"value":"Time-Based Filters - Attribute & Behavior","id":"time-based-filters---attribute--behavior","depth":1},{"value":"How to Set up Time Filters","id":"how-to-set-up-time-filters","depth":2},{"value":"Data Type Supported","id":"data-type-supported","depth":3},{"value":"Steps to Configure Time Filter","id":"steps-to-configure-time-filter","depth":2}],"frontmatter":{"seo":{"title":"Time-Based Filters - Attribute & Behavior","description":"Learn how to create attribute and behavior filters based on timestamps for segment creation in Audience Studio using the Audience API."}},"lastModified":"2026-02-17T14:14:59.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/apis/audience-api/time-based-filters","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}