Rich-text Reply

PHP rest api set dimension value

hemang 10-10-15

PHP rest api set dimension value

hi 

 

I am using optimizely and it is working as expected if I use JS API. Now, I want some functionality as mentiond below using PHP REST API

 

1.Creating a custom dimension 

2.Creating audience with Segmentation yes with condition of above mentioned custom dimension has particular value

3.I want to set that particular value to custome dimension using PHP REST API not using by putting JS snippet with setDimension Value 

 

Let me know among above mentiond requirement I know  #1 is posible what about other two 

 

 

Thanks

Hemang

Level 2

MartijnSch 10-13-15
 

Re: PHP rest api set dimension value

Hi Hemang,

How about this API endpoint to trigger the second step in your request: http://developers.optimizely.com/rest/reference/index.html#create-audience ? It should be able to let you create a audience based on the conditions that you will enter.

3. Will be harder, and I don't have experience doing it like that with the JS API in mind as well. But hopefully somebody from Optimizely will jump in to help with this.

Re: PHP rest api set dimension value

Hi Hemang,

 

Thanks for contributing to the Optiverse! I'm Becca Bruggman a Solutions Architect at Optimizely and wanted to jump in to offer some guidance around the REST API functaionality. Thanks @Martjnsch for providing your help here Smiley Happy

 

1. You're correct. You can create a custom dimension through the REST API, documentation [here]

 

2. Turning on segmentation for this audience is also possible as "conditions" and "segmentation" are both editable fields when creating an audience through our REST API, documentation [here]

 

3. If I'm understanding this question, you are wanting to set this custom dimension for a specific visitor to your website using a REST API call, is that correct? If that is the case, this would need to be done using the JavaScript API and calling setDimensionValue to set that custom dimension for that particular visitor. The REST API offers a robust feature set, but you can think of it as offering everything the Optimizely platform offers within it's web interface (ie. creating/update experiments), while manipulating visitor attributes would done within the browser via our JavaScript API.

 

Did I explain the above well? Did I understand your thurd question correctly?

 

Thanks,
Becca

hemang 10-26-15
 

Re: PHP rest api set dimension value

Hi @Becca


Thanks for your response.


I want only setDimensionValue using PHP REST API not by adding javascript snippet. Is it possible?


Thanks
Hemang
Level 2

Re: PHP rest api set dimension value

Hi Hemang,

 

Thanks for following up! To set a dimension for a specific visitor, this can only be done via the JavaScript API.

 

You can see all the possibilities for working with dimensions via the Optimizely REST API here: http://developers.optimizely.com/rest/reference/index.html#dimension.

 

I will also note, while you can build out the your experiment set-up with the Optimizely REST API, you will still need to include the Optimizely snippet on each page you are wanting to run these tests on your website, make visual changes to your website and track the behavior of your visitors within these experiments.

 

Hope that helped clarify the answers I had provided. Did you have any follow-up questions?

 

Thanks,

Becca

hemang 10-28-15
 

Re: PHP rest api set dimension value

Hi @Becca,


Thanks for reply.


Last time asking Is it possible to set custom dimension value only with PHP REST API. Actually , I want in my site some one login I want add value for a custom dimension by programming not by adding javascript snippet.

Got my concern? if so then let me know is it possible


Thanks
Hemang
Level 2
Amanda 10-28-15
 

Re: PHP rest api set dimension value

@hemang - You *must* use the JavaScript API to set the custom dimension value. This dimension value must be set client side.

 

Unfortunately you cannot set the value using the Rest API. In fact, the Rest API does not allow you to do anything at the user level.  Is there a reason that you don't want to use JS to set the dimension value? 

 

I'm sorry if this causes any inconvenience. Let me know if this clears things up for you.  

Optimizely