Skip to content

Commit 04b118e

Browse files
authored
Merge pull request #87 from taboola/pcimring-taboola-patch-1
Update README.md - add a code sample for campaign-specific goal
2 parents fa2e93b + b30a5b4 commit 04b118e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,30 @@ try {
9191
}
9292
```
9393

94+
### 2.1. Example - Setting a campaign-specific conversion goal
95+
96+
```
97+
Backstage backstage = Backstage.builder().build();
98+
BackstageAuthentication auth = backstage.authenticationService().clientCredentials("clientId_example", "clientSecret_example");
99+
100+
CampaignUnipRuleOptimizations conversionRules = new CampaignUnipRuleOptimizations();
101+
UnipRuleConfiguration unipRule = new UnipRuleConfiguration();
102+
unipRule.setId(1L); //-> The ID which you would like the campaign to optimize towards
103+
conversionRules.setRules(Collections.singletonList(unipRule));
104+
105+
CampaignOperation createCampaignOperation = CampaignOperation.create()
106+
.setName("My Campaign")
107+
.setStartDate(new Date())
108+
.setCpc(1.0D)
109+
.setBrandingText("My Branding Text")
110+
.setSpendingLimit(100D)
111+
.setSpendingLimitModel(SpendingLimitModel.ENTIRE)
112+
.setConversionRules(conversionRules);
113+
114+
Campaign campaign = backstage.campaignsService().create(auth, "demo_account_id", createCampaignOperation);
115+
//-> do something with the campaign...
116+
```
117+
94118
### 3. Authentication
95119

96120
Supports:

0 commit comments

Comments
 (0)