> For the complete documentation index, see [llms.txt](https://growingio.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://growingio.gitbook.io/docs/developer-manual/debugging/verification/evar.md).

# evar（转化变量）事件

验证“转化变量”数据。

> 场景：在购物场景中，用户可以通过首页Banner、商品列表页等方式进入某个商品详情页，进而产生下单行为，想要知道不同的前序行为对于下单的贡献，就可以将商品详情页的入口来源定义为转化变量，用于分解下单行为（埋点事件）

**转化变量配置方式示例**

| 标识符               | 名称         | 描述                  | 归因              | 失效              |
| ----------------- | ---------- | ------------------- | --------------- | --------------- |
| enterSource\_evar | 商品详情页的入口来源 | 取值包括首页Banner、商品列表页等 | 根据需求选择（不涉及数据验证） | 根据需求选择（不涉及数据验证） |

**对应的代码**

此示例中的转化变量为“商品详情页的入口来源（enterSource\_evar）”，当进入详情页时设置了这个转化变量。

| 平台          | 原型                                                                                                                                                                          | 代码示例                                                                                                                                                                                                                                       |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| JS SDK      | gio('evar.set', key, value);或gio('evar.set', conversionVariables);                                                                                                          | gio('evar.set', 'enterSource\_evar', '首页Banner');或gio('evar.set', {'enterSource\_evar': '首页Banner'});                                                                                                                                      |
| Android SDK | <p>GrowingIO.getInstance().setEvar(String key, String value);</p><p>或</p><p>GrowingIO.getInstance().setEvar(JSONObject conversionVariables);</p>                            | <p>GrowingIO.getInstance().setEvar("enterSource\_evar", "首页Banner");</p><p>或</p><p>JSONObject jsonObject = new JSONObject();</p><p>jsonObject.put("enterSource\_evar", "首页Banner");</p><p>GrowingIO.getInstance().setEvar(jsonObject);</p> |
| iOS SDK     | <p>+ (void)setEvarWithKey:(NSString \*)key andStringValue:(NSString \*)stringValue;</p><p>或</p><p>+ (void)setEvar:(NSDictionary\<NSString \*, NSObject \*> \*)variable;</p> | <p>\[Growing setEvarWithKey:@"enterSource\_evar" andStringValue:@"首页Banner"];</p><p>或</p><p>\[Growing setEvar:@{@"enterSource\_evar":@"首页Banner"}];</p>                                                                                    |

**数据验证方法**

在对应的应用（网站、Android 或者 iOS App）中触发设置了转化变量的时机，通过 Debugger 工具验证数据准确性

按照如下流程图验证

![](https://2602900487-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lo08UtW7H58ehFKeZ4g%2F-LrMfRGR61XZYaQFSp16%2F-LrMfUmCTSqguokbKaTk%2Fevar1x2.png?alt=media\&token=4f4b4c6c-b771-49be-9d0d-f956d45b62a5)

在本例中，如下图的数据请求说明打点代码生效

![](https://2602900487-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lo08UtW7H58ehFKeZ4g%2F-LrINA_0K1-vYE4Pf_KO%2F-LrIOMjx3znc4lyoWDO2%2Fevar.png?alt=media\&token=943aaaa1-ea54-4bbe-bb93-b0c3d074ec0d)
