Adobe Analytics overwriting visitorID

大憨熊 提交于 2019-12-11 11:08:33

问题



I need to overwrite the default visitorID, that's automatically set by Adobe Analytics s_code, with a custom value.
As explained here, I may set the s.visitorID variable for this purpose but It's not clear to me how, and overall when, doing so.
I guess this variable should be set into the s_code itself but I fear that the automatic visitorID would be used anyway for the first s.t() call, in the place of the custom value I'd like to use.

In fact, I want that since the first automatic request the custom visitorID is used.

In addiction, assumed that the custom value is passed within a GET parameter, I'd like to know if the "Query string parameter on the image request" ("vid" param) could be used for this scenario. and how (is the second method listed in the link above).

Thank you.


回答1:


Some thoughts and words of warning about setting the vistor id yourself:

There are some benefits to setting the visitor id yourself. The main benefit is that you are 100% in control of how visit(or)s are tracked. Another good reason to do this is if you already have a visitor id infrastructure in place on your site, setting AA's visitor id to what you already have can potentially make it easier to tie data to or cross-reference data between AA and other places that utilize that visitor id.

Sidenote for that.. It is possible to get the visitor ids from Adobe from various places (e.g. Data Warehouse, Data Workbench, using the Adobe API), but currently there is no report in Adobe Analytics itself to see the visitor id, even if you set it yourself. To get around this, you can also assign it to a prop and/or eVar, which is visible in AA reports. But this is not possible with the 3rd party cookie tracking (because javascript cannot read 3rd party cookies), so that is another benefit to setting it yourself.

Beyond that, IMO there are basically no benefits to setting it yourself. On the other hand.. now for some warnings...

Setting a value in visitorID or vid or equivalent does NOT cause AA to update the visitor id in its cookie. AA continues to generate/output the visitor id in the cookie and then on AA server, and it simply overwrites that value with your visitor id for that hit (on the backend, on the collection server). But it does NOT update the cookie with your new visitor id.

The implication here is that if you want to set the visitor id yourself, you are essentially putting the responsibility on yourself to keep track of the visitor. So, you must have your own infrastructure in place that not only generates the id, but preserves it and ties it to the visitor, so that it can be output on every page the visitor views - including if the visitor navigates between multiple domains your tracking code is implemented on (if applicable).

If you do not do this, then the visit(or) will break and count as a new visit(or) going from page to page, or when the visitor hop from domainA to domainB. How often the break actually occurs is directly tied to how often you are actually outputting the visitor id yourself (with a correct value). For example if you only set it on first hit, and then on never set it, the visit(or) will break once, because from 2nd hit + AA will just default to using its own generated visitor id.

To put this into perspective.. I've had my fingers in the web analytics pie for almost 10 years now, the last 6 of them working full time for a high profile web analytics agency, so this is basically all I do for a living. I've worked with I don't even know how many clients by now (over 100 for sure), and there has only been one client who actually went through with setting the visitor id themselves. I'm just mentioning this so that you understand that (from my experience, anyways), this is not something most clients embark upon. So, make sure you are absolutely confident about your methods for generating and keeping track of visitor id values before doing this.

Having said that, if you still want to do this...

Firstly, to be clear about the link you posted, those are examples of how the visitor id can be set depending on your implementation. Adobe offers several ways to record data, and the javascript method is just one way. The examples on that page show what you'd set for some of the other ways (including the js way).

The point here is that not all of those methods may be relevant to you, depending on your implementation. For example, if you are only implementing AA with javascript (whether it be the core s_code.js or through DTM or w/e), the only one relevant to you is s.visitorID.

So for example, yes, you can use s.visitorID to override AA's default visitor id generation, for javascript implementation. If you set that variable, you will see the vid param show up in the request to AA (look at the request sent to the AA collection server with a packet sniffer, or with browser addon or dev tools net/traffic tab).

The reason vid was mentioned on that link is because that is what you'd use if you are manually building the request URL to AA. For example, if you don't want to use the javascript implementation, and instead want to use server-side logic to build and output an image tag yourelf, or send data to Omniture directly from your server (e.g. cURL), the vid param is what you'd set for the visitor id.

Sidenote: hardcoding your own image request is kind of a throwback for mobile device tracking in earlier times when mobile devices did not consistently or fully support javascript. Pretty much all modern mobile devices these days fully support javascript, and on top of that, Adobe has done a lot of work over time streamlining the core AA library to be leaner and more efficient whether viewing on desktop or mobile browser (make sure you are using the latest version of AppMeasurement library).

So IOW if you are using the javascript library, you don't need to worry about the vid param, because the js library already does it. Although for QA purposes, you can check that it is there with your value on a given request.

As far as "how" to set it.. assuming you're implementing it with javascript: you set it like any other AA variable. Somewhere between the AA library loading and the s.t or s.tl trigger, you assign a value to it, e.g.

s.visitorID="[my value here]";

Where specifically you set it, depends on how you have implemented AA. For example, if you have implemented AA through DTM, and you have your custom visitor id exposed on your page before the DTM library is loaded (e.g. some data layer property, or in a cookie), you can create a data element that grabs that value, and then in the AA > Tool Config > Cookie > Visitor ID field, you can specify your data element, and DTM will set it for you (but you are still responsible for making sure whatever source the data element draws from is there)

And again, note that even if you set it, you will still see AA's default generated id in their cookie and request urls. The override happens on AA's collection server, which you do not have visibility into. To verify that AA is actually using your custom value, you will need to export it from AA (e.g.with a data warehouse export).



来源:https://stackoverflow.com/questions/28609445/adobe-analytics-overwriting-visitorid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!