You might want to assign a visitor to a segment programmatically instead of using the Convert interface options to add it.
- Find out the segment id. This is a bit tricky as you have to add the audience (that you have designated as a segment) to an experience to be able to find it.
You can find this on the Audience card under the Experience Summary. Please see the image below for an example:
- Code it. Adapt the following example to programmatically add a visitor to a segment:
- Test your code as a normal visitor in an incognito browser window and verify that the cookie _conv_v has the segment id recorded on the seg key. You can find more information about the cookie structure in the following article.