This is an article about the Google Analytics feature ‘_set’ with the permission of the Author: Natzir Turrado, online marketing expert. Original title: Cómo utilizar ‘_set’, una nueva función de Google Analytics.
Google Analytics launched few months ago a new feature called ‘_set’, the problem is that there is no documentation whatsoever (not by Google itself). This article will focus on the solution (or one of them) to the total loss of the transactions in some of Analytics profiles (with filters) from September 2012.
Disclamer: this article is very technical. Who is it for? Someone who is tracking an ecommerce with Google Analytics, works with virtual pages and uses filters.
Background: Until september of last year, the number of hits of the ecommerce on Google Analytics weren’t associated with the dimension of the page or hostname, so any filter based in those dimensions wouldn’t affect the collection of transactions. Now, when a transaction is launched the hits of the ecommerce include the title of the page (utmdt), hostname (utmhn), URI (utmp) and the keywords used in the internal search engine. Wherewith any filter that works with these dimensions would remove the ecommerce transactions.
That is to say, this parameter utmp from the transaction is proper of tracktrans and collects the real URL of the page and it’s affected by the filters. And also, is no possible to edit (or nearly as seen below) as we normally do with pages to add the logical or virtual part.
Example: Suppose we want to create a profile based on language, ie a profile that collects the consumption data for Spanish content and being our addresses so: uri?virtualpage=/id_es/
- If we do a “include” filter with the logical URL (includes all that contains “/id_es”), we will lose the ecommerce data since this URL do not have any logical part.
- If we do a “exclude” filter with logical URL (excluding all that contains “/id_es”) we are including all the URLs without logical part and therefore the entire ecommerce data appear regardless of the language or the language version of the site where the transaction is made.
The method _set
So one solution to this is found with the new method ‘_set’, that what it does is change the way we will register a page from that time, regardless of whether it is a trackpageview, trackevent or tracktrans. It would be like saying, “from now on that page is called X”.
Its operation is as follows:
This way, the Google Analytics Tracking Code for a transaction will look like this:
var _gaq = _gaq || ;
_gaq.push(['_addTrans', 'apples-1234', '', '12']);
_gaq.push(['_addItem', 'apples-1234', 'SKU-ABCD', '', '', '12', '1']);
Also if we want we can also change the title of that page, not only the URI as follows:
With this we can have a logical title associated with an ecommerce.
And the same for the events. For example, suppose that you are launching events over virtual pages from a buying process that maintains the same URL on all the steps. What happens is that you will not be able to see exactly what page has been launched that event. So in that case it will be OK to use the ‘_set’ method, thus the event will be automatically associated to the page you choose.