Say you have an online store where you sell clothes for men, women and kids. You (and your boss) are not satisfied with aggregate data, so you go to your friendly marketing manager and web analyst and ask them to segment and segment deep! What you really want is to have more visibility into the shopping experience based on:
- products and departments of interest
- departments: men, women, etc.
- categories: athletic, suits, shirts, etc.
- special sections: wedding registry, wish list, etc.
- buyers & non-buyers
- site language selection: English, Spanish, etc.
What does "Multiple Custom Variables" do?
The Multiple Custom Variables feature allows us to label visitors at three levels, "visitor", "session" and "page". Note: none of the data from MCV personally identifies a visitor - these are totally anonymous labels.1. Visitor-level Labels
2. Session-level Labels
3. Page-level Labels
Visitors can be assigned to labels at the page level if they interact with certain events (flash, video, Ajax...) or view certain pages.Example 1:
Tom is an English-speaking visitor, viewed a product (women pajamas), added the item to the shopping cart and then completed the purchase transaction.
Sara is a Spanish-speaking visitor, viewed a few products (men and women apparels), and then left the site without buying.
The How
1. Customizing the tracking code:
Visitor-level Labels
At the visitor level we will use custom variables to segment visits based on the site interface language selection. This custom variable will stay attached to the visitors for future visits starting from the visit in which they selected the interface language (until they clear their cookies).Setting the value of "interface-language":
Visitors are assigned to the language segment according to their selection in the language form.
<form onSubmit="pageTracker._setCustomVar(1, 'interface-language', this.mymenu.options[this.mymenu.selectedIndex].value, 1); pageTracker._trackPageview()">
<select name=mymenu>
<option value="arabic">Arabic</option>
<option value="english">English</option>
<option value="franch">Franch</option>
<option value="spanish">Spanish</option>
<input type="submit" name="Submit" value="Submit">
</form>
pageTracker._setCustomVar(2, "visitor-type", "Buyer", 2);
If it is not possible to add the custom code inside the GATC, then add the following code after the GATC:
<script type="text/javascript">
pageTracker._setCustomVar(2, "visitor-type", "Buyer", 2);
pageTracker._trackPageview();
</script>
Page-level Labels
At the page level we will use custom variables to determine which products' categories and store departments are more visited. We will set a custom variable at the page level for each product, where the product category and the department for that product is set as a custom variable.
Setting the value of "store-department" and "product-category":
In each product page, add the following code inside the GATC right before the pageview GIF request _trackPageview()
pageTracker._setCustomVar(3, "store-department", “Men", 3);
pageTracker._setCustomVar(4, "product-category", "Suits", 3);
<script type="text/javascript">
pageTracker._setCustomVar(5, "gift-option", "Baby-Registry", 3);
pageTracker._trackPageview();
</script>
www.domain.com/wedding-registry.html
<script type="text/javascript">
pageTracker._setCustomVar(5, "gift-option", "Wedding-Registry", 3);
pageTracker._trackPageview();
</script>
<script type="text/javascript">
pageTracker._setCustomVar(5, "gift-option", "Wish-List", 3);
pageTracker._trackPageview();
</script>