'Where to get the index id for a custom dimensions in the google analytics measurement protocol

I am using google analytics collects API call

https://developers.google.com/analytics/devguides/collection/protocol/v1/reference#using-post

I just wanted to know whether it supports multiple custom dimensions in post-call

This is post body which I am sending

v=1&tid=UA-XXXXXXX-YY&cid=555&t=event&el=holiday&ea=play&cs=(direct)&cm=organic&ec=video&ev=55&cd1=Sports&cd2=Music

where cd1 and cd2 are custom dimensions



Solution 1:[1]

If you check the documentation for Custom Dimensions / Metrics

enter image description here

You will notice that the dimension has an index attached.

so if you want to send a value for custom dimension 1 you send it as cd1 if you want to send a custom dimension for custom dimension 2 then you send cd2.

These are the custom dimensions set up in your google analytics account.

enter image description here

The index is the index number you send to the measurement protocol.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DaImTo