File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ use Databox\Api\DefaultApi;
5252use Databox\ApiException;
5353use Databox\Configuration;
5454use Databox\Model\PushData as DataboxPushData;
55+ use Databox\Model\PushDataAttribute;
5556use GuzzleHttp\Client;
5657
5758execute();
@@ -79,8 +80,19 @@ function execute()
7980 ->setKey('<METRIC _KEY_NAME >') // for e.g. sessions
8081 ->setValue(125)
8182 ->setDate('2017-01-01T00:00:00Z') // Date in ISO8601 format
82- ->setUnit('<UNIT >') // for e.g. $
83- ->setAttributes(['<DIMENSION _VALUE >']); // for e.g. ['US']
83+ ->setUnit('<UNIT >'); // for e.g. $
84+
85+ // Optional
86+ if (true) { // If you want to push data to a specific dimension
87+ $pushDataAttribute = new PushDataAttribute(
88+ [
89+ 'key' => '<DIMENSION _KEY >', // for e.g. country
90+ 'value' => '<DIMENSION _VALUE >' // for e.g. US
91+ ]
92+ );
93+
94+ $pushData->setAttributes([$pushDataAttribute]);
95+ }
8496
8597 try {
8698 $apiInstance->dataPost([$pushData]);
Original file line number Diff line number Diff line change 66use Databox \ApiException ;
77use Databox \Configuration ;
88use Databox \Model \PushData as DataboxPushData ;
9+ use Databox \Model \PushDataAttribute ;
910use GuzzleHttp \Client ;
1011
1112execute ();
@@ -33,8 +34,19 @@ function execute()
3334 ->setKey ('<METRIC_KEY_NAME> ' ) // for e.g. sessions
3435 ->setValue (125 )
3536 ->setDate ('2017-01-01T00:00:00Z ' ) // Date in ISO8601 format
36- ->setUnit ('<UNIT> ' ) // for e.g. $
37- ->setAttributes (['<DIMENSION_VALUE> ' ]); // for e.g. ['US']
37+ ->setUnit ('<UNIT> ' ); // for e.g. $
38+
39+ // Optional
40+ if (true ) { // If you want to push data to a specific dimension
41+ $ pushDataAttribute = new PushDataAttribute (
42+ [
43+ 'key ' => '<DIMENSION_KEY> ' , // for e.g. country
44+ 'value ' => '<DIMENSION_VALUE> ' // for e.g. US
45+ ]
46+ );
47+
48+ $ pushData ->setAttributes ([$ pushDataAttribute ]);
49+ }
3850
3951 try {
4052 $ apiInstance ->dataPost ([$ pushData ]);
You can’t perform that action at this time.
0 commit comments