Until now, in order to call specific API campaigns, you had to refer to them by their unique API selector name via a CHOOSE call (see Choosing Variations and Pageviews). Any change to the campaign’s selector name required a change in your API requests as well.
To streamline the process and reduce the workload on your R&D team, Dynamic Yield now supports grouping API campaigns, and applying them in your CHOOSE calls. Your developers can refer to a static API selector group, without having to worry about any changes made to a specific campaign’s selector name. All the active campaign selectors in the group are sent back in the response to your CHOOSE call, enabling you to call relevant campaigns by their correct selector names as you usually do.
API selector groups are defined and assigned in the Dynamic Yield console, and the Campaigns page supports filtering by selector groups so that you always know which campaign is assigned to which group.
Note that a campaign can’t belong to more than 10 groups, and a selector group name cannot be longer than 255 characters.
Example of a CHOOSE API request using API selector groups:
{
2 "selector": {
3 "names": [
4 "test1"
5 ],
6 "groups": [
7 "HOMEPAGE"
8 ]
9 },
10 "user": {
11 "dyid": "-4350463893986789401",
12 "dyid_server": "-4350463893986789401"
13 },
14 "session": {
15 "dy": "ohyr6v42l9zd4bpinnvp7urjjx9lrssw"
16 },
17 "context": {
18 "page": {
19 "type": "HOMEPAGE",
20 "location": "https://example.org",
21 "locale": "en_US",
22 "data":[]
23 },
24 "device": {
25 "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
26 "ip": "54.100.200.255"
27 }
28 },
29 "options": {
30 "isImplicitPageview": false,
31 " returnAnalyticsMetadata": false
32 }}
Example of a choose API response using API Selector Groups:
{
2 "choices": [
3 {
4 "id": 484687,
5 "name": "test1",
6 "type": "DECISION",
7 "groups":["HOMEPAGE"],
8 "variations": [
9 {
10 "id": 21831162,
11 "payload": {
12 "type": "CUSTOM_JSON",
13 "data": {
14 "hello": 1
15 }
16 }
17 }
18 ],
19 "decisionId": "l7QtNjM5NDkxMzUzMDQ1MjE4NjYyMs4ADcQTpzgyODQwMDEBkJHOAU0d+qUzMjc3Mw=="
20 },
21 "id": 55555,
22 "name": "Campaign1",
23 "type": "DECISION",
24 "groups":["HOMEPAGE"],
25 "variations": [
26 {
27 "id": 21831162,
28 "payload": {
29 "type": "CUSTOM_JSON",
30 "data": {
31 "hello": 1
32 }
33 }
34 }
35 ],
36 "decisionId": "l7QtNjM5NDkxMzUzMDQ1MjE4NjYyMs4ADcQTpzgyODQwMDEBkJHOAU0d+qUzMjc3Mw=="
37 },
38 "id": 666666,
39 "name": "Campaign2",
40 "type": "DECISION",
41 "groups":["HOMEPAGE"],
42 "variations": [
43 {
44 "id": 21831162,
45 "payload": {
46 "type": "CUSTOM_JSON",
47 "data": {
48 "hello": 1
49 }
50 }
51 }
52 ],
53 "decisionId": "l7QtNjM5NDkxMzUzMDQ1MjE4NjYyMs4ADcQTpzgyODQwMDEBkJHOAU0d+qUzMjc3Mw=="
54 },
55 "id": 88888,
56 "name": "Campaign3",
57 "type": "DECISION",
58 "groups":["HOMEPAGE"],
59 "variations": [
60 {
61 "id": 21831162,
62 "payload": {
63 "type": "CUSTOM_JSON",
64 "data": {
65 "hello": 1
66 }
67 }
68 }
69 ],
70 "decisionId": "l7QtNjM5NDkxMzUzMDQ1MjE4NjYyMs4ADcQTpzgyODQwMDEBkJHOAU0d+qUzMjc3Mw=="
71 }
72 ],
73 "cookies": [
74 {
75 "name": "_dyid_server",
76 "value": "-4350463893986789401",
77 "maxAge": "31556926"
78 },
79 {
80 "name": "_dyjsession",
81 "value": "ohyr6v42l9zd4bpinnvp7urjjx9lrssw",
82 "maxAge": "1800"
83 }
84 ]
85}