{"_id":"575ff4e6c0bca70e00afbfa1","version":{"_id":"5429beef1163360800ed31fd","__v":21,"project":"5429beef1163360800ed31fa","createdAt":"2014-09-29T20:19:59.904Z","releaseDate":"2014-09-29T20:19:59.904Z","categories":["5429beef1163360800ed31fe","55e74e1f5d36b32b002563fa","55e7500a73169617001f2e86","55e76b8196131b2f00bf4b72","55e89569cdbb8a350096df9c","55f8935eb089b71700a8364e","55f8a67d3bb4bb0d0022d093","55f9dbefc7ef770d00d9bf6d","5601c21a22ecf60d002b27b3","5601c21ff12aee0d001bb06e","5601c2256c7b610d00280db5","5601c22c22ecf60d002b27b4","5603738d0c78b00d0039af47","5626f70bfcbbc621004ebf52","566f7a1ae144ab0d00e9732f","566f85ca7820960d00c3b93d","56708ce43a32d20d00c45cbf","56708d436995210d003aad8e","5736471abe10a9200030732c","57a82c7aff9bd30e00a6f1c1","591b8500e3992319007190f4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"parentDoc":null,"user":"563b4a20dfa1282b000dd262","category":{"_id":"55e89569cdbb8a350096df9c","__v":14,"project":"5429beef1163360800ed31fa","pages":["55e896ac4535442d00ccacf3","55e8b205f0f1850d00d24a59","55e8b243720fde1700659a0e","55e8b4258c0c601700f978e0","55e8b5537cdf7119002d2e3a","55e8b5737cdf7119002d2e3c","55e8b5863fef5017000dbd9f","55e8b59ef0f1850d00d24a63","563b50349e3f2225009fd296","5640d891d4b2e00d00bb3d48","564cfd4e2248461700bd4021","5660e89689e82f0d008f6832","5668d3428ff3da0d0079092f","56abb944f25f160d00e17f40"],"version":"5429beef1163360800ed31fd","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-09-03T18:46:01.692Z","from_sync":false,"order":1,"slug":"sdk-integrations","title":"Integrating for Web"},"__v":12,"project":"5429beef1163360800ed31fa","updates":["581e20cc0102b50f008d583e"],"next":{"pages":[],"description":""},"createdAt":"2016-06-14T12:13:26.943Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"https://pdb.adsnative.com/seg.gif?segment_token=DLQUBB4X&action=add&uuid=b3e1d7fa-e449-4189-97da-5a8be85744b4","language":"http"}]},"method":"get","results":{"codes":[{"name":"","code":"{}","language":"http","status":200}]},"settings":"59c57f5ceb1ccd001c8e95ef","auth":"required","params":[{"_id":"59c5812d733a11001cfe7a1f","ref":"","in":"query","required":true,"desc":"A unique segment token per audience segment provided by Polymorph","default":"","type":"string","name":"segment_token"},{"_id":"59c5812d733a11001cfe7a1e","ref":"","in":"query","required":false,"desc":"Action to be performed for current user. Default: 'add' which adds current uuid into the specified audience segment. 'delete' will remove the uuid from the segment","default":"add","type":"string","name":"action"},{"_id":"59c5812d733a11001cfe7a1d","ref":"","in":"query","required":false,"desc":"A unique user id to identify current user. If empty, it will generate a new uuid and drop it as a cookie on the users device. Publishers should hash any internal uuid such as email address before passing it here.","default":"","type":"string","name":"uuid"}],"url":"/seg.gif"},"isReference":true,"order":9,"body":"You can capture audience segments by using the JavaScript above. You need to invoke the javascript from your website when you want to add a user to an existing audience segment.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!-- Begin ADSNATIVE Code -->\\n<script type = \\\"text/javascript\\\" >\\n    var ANSegmentPixel = function(e) {\\n        if (undefined != typeof e && e) {\\n            var d = \\\"https://pdb.adsnative.com/seg.gif?segment_token=\\\" + e;\\n            document.write('<img src=\\\"' + d + '\\\" width=\\\"1\\\" height=\\\"1\\\" border=\\\"0\\\"/>');\\n        }\\n    };\\n\\t  ANSegmentPixel('5MGHWWE3');\\n</script>\\n<noscript>\\n    <img src = \\\"https://pdb.adsnative.com/seg.gif?segment_token=DLQUBB4X\\\" width = \\\"1\\\" height = \\\"1\\\" border = \\\"0\\\" />\\n</noscript>\\n<!-- End ADSNATIVE Code —>\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nIn the script above, '5MGHWWE3' is the segment token of the audience segment you want to add user to. You need to replace it with the token of your segment (as listed on Console).\n\nIf you want to capture audience segments through server side API instead of JavaScript, please refer to this [documentation](http://dev.adsnative.com/v1.0/docs/audience-segments-api).\n\nFor instructions on creating and managing audience segments on Console, please refer to this [documentation](http://dev.adsnative.com/v1.0/docs/profile-db).","excerpt":"API for publishers to build Audience Segments (ProfileDB) using AdsNative platform","slug":"audience-segments-js","type":"endpoint","title":"Audience Segments"}

getAudience Segments

API for publishers to build Audience Segments (ProfileDB) using AdsNative platform

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

segment_token:
required
string
A unique segment token per audience segment provided by Polymorph
action:
stringadd
Action to be performed for current user. Default: 'add' which adds current uuid into the specified audience segment. 'delete' will remove the uuid from the segment
uuid:
string
A unique user id to identify current user. If empty, it will generate a new uuid and drop it as a cookie on the users device. Publishers should hash any internal uuid such as email address before passing it here.

Examples


Result Format


Documentation

You can capture audience segments by using the JavaScript above. You need to invoke the javascript from your website when you want to add a user to an existing audience segment. [block:code] { "codes": [ { "code": "<!-- Begin ADSNATIVE Code -->\n<script type = \"text/javascript\" >\n var ANSegmentPixel = function(e) {\n if (undefined != typeof e && e) {\n var d = \"https://pdb.adsnative.com/seg.gif?segment_token=\" + e;\n document.write('<img src=\"' + d + '\" width=\"1\" height=\"1\" border=\"0\"/>');\n }\n };\n\t ANSegmentPixel('5MGHWWE3');\n</script>\n<noscript>\n <img src = \"https://pdb.adsnative.com/seg.gif?segment_token=DLQUBB4X\" width = \"1\" height = \"1\" border = \"0\" />\n</noscript>\n<!-- End ADSNATIVE Code —>", "language": "javascript" } ] } [/block] In the script above, '5MGHWWE3' is the segment token of the audience segment you want to add user to. You need to replace it with the token of your segment (as listed on Console). If you want to capture audience segments through server side API instead of JavaScript, please refer to this [documentation](http://dev.adsnative.com/v1.0/docs/audience-segments-api). For instructions on creating and managing audience segments on Console, please refer to this [documentation](http://dev.adsnative.com/v1.0/docs/profile-db).

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}