# 对 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 工具验证数据准确性

按照如下流程图验证

![](/files/-M9qZ5IHl4htrLuujkWT)

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

![](/files/-M9qZA9K-GUxnbC-ZJrO)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://growingio.gitbook.io/v3/developer-manual/debugging/verification/evar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
