How to Run Analysis on Tags (formerly Adobe Launch) Rules
Have you ever wanted to do analysis on your Tags (formerly Adobe Launch) Rules? Find out what rules are most frequently used? Or which rules are failing? This blog post provides a quick and simple way to leverage Tagtician and Adobe Analytics to track the performance of your Tags configuration and answer some of the basic questions surrounding your implementation. It will help answer the following questions:
Getting these answers wouldn’t be just interesting but would help you big time optimize/audit your Launch property by:
To achieve this, here is high level plan:
- Tagtician Export of your Launch Library.
- A Launch rule to track rule names using Launch library monitoring APIs.
- A list prop to capture rules’ names and classification reports to upload other data pertaining to Launch Rules.
Alright! Let’s get started…
1. Getting Ready:
1. Get Tagtician export of your Launch property.
2. Copy names of all the rules from Tagtician export and paste them in a new sheet. In the next column, name them as R1, R2, R3 so on…
3. Now create a JSON with rule names as Keys and abbreviations as Values. You can name JSON as “ruleLookUp”.
var ruleLookUp = {
"All Pages | DOM Ready | AA":"R1",
"All Pages | Lib Loaded | AT":"R2",
"User Login | Successful | AA":"R3",
"Impression | Media Pixels | gTag":"R4",
"PDP | DOM Ready | AA":"R5",
"Search Results | DOM Ready | AA":"R6",
"Search | Direct Call | AA":"R7",
"PDP | Add to Cart| Click | AA":"R8",
"Cart | Coupon | Click | AA":"R9",
"Cart | Removal | Click | AA":"R10",
"Transaction | DOM Ready | AA":"R11",
"FirstPage | LinkText | Click | FB - addToCart":"R12",
"Form Submit | Direct Call | AA":"R13",
"All Pages | Window Loaded | AA - Send Beacon":"R14",
"Video | Direct Call | AA":"R15",
"Link Click | Click | AA":"R16",
"Search | Filters | Direct Call | AA":"R17"
}
4. Enable two props in Adobe Analytics e.g. prop1 and prop2, name them “Rules Fired” and “Rules Failed Over Conditions” respectively.
5. Turn list support ON for these props.
2. Launch configurations
1. Create a rule in Launch with the following configurations:
Condition: N.A.
This rule is supposed to run 1st on each page load. In case of SPA, you might want to change the event but ensure the order.
2. Now add Action – custom code JavaScript type – in the rule.
3. Now the idea is to capture rules which completed and those which failed over conditions into two separate arrays and put them in list props and send them in page load beacon.
For this, you will need Tags monitoring APIs. Here is detailed blog on monitoring hooks by Aaron Hardy.
var ruleCompleted = new Array();
var ruleConditionFailed = new Array();
window._satellite = window._satellite || {};
window._satellite._monitors = window._satellite._monitors || [];
window._satellite._monitors.push({
ruleCompleted: function (event) {
ruleCompleted.push(event.rule.name);
},
ruleConditionFailed: function (event) {
ruleConditionFailed.push(event.rule.name);
}
});
4. At this moment we have two problems:
Solution to these problems are Local Storage and using Rules abbreviation (instead of full name) respectively.
5. Here is how the final code will look like:
var ruleCompleted = new Array();
var ruleConditionFailed = new Array();
var ruleLookUp = {
"All Pages | DOM Ready | AA":"R1",
"All Pages | Lib Loaded | AT":"R2",
"User Login | Successful | AA":"R3",
"Impression | Media Pixels | gTag":"R4",
"PDP | DOM Ready | AA":"R5",
"Search Results | DOM Ready | AA":"R6",
"Search | Direct Call | AA":"R7",
"PDP | Add to Cart| Click | AA":"R8",
"Cart | Coupon | Click | AA":"R9",
"Cart | Removal | Click | AA":"R10",
"Transaction | DOM Ready | AA":"R11",
"FirstPage | LinkText | Click | FB - addToCart":"R12",
"Form Submit | Direct Call | AA":"R13",
"All Pages | Window Loaded | AA - Send Beacon":"R14",
"Video | Direct Call | AA":"R15",
"Link Click | Click | AA":"R16",
"Search | Filters | Direct Call | AA":"R17"
}
if(localStorage.getItem("ruleCompleted")){
ruleCompleted.push(localStorage.getItem("ruleCompleted"));
}
window._satellite = window._satellite || {};
window._satellite._monitors = window._satellite._monitors || [];
window._satellite._monitors.push({
ruleCompleted: function (event) {
ruleCompleted.push(ruleLookUp[event.rule.name]);
localStorage.setItem("ruleCompleted", ruleCompleted.join("|").toString());
},
ruleConditionFailed: function (event) {
ruleConditionFailed.push(ruleLookUp[event.rule.name]);
localStorage.setItem("ruleConditionFailed", ruleConditionFailed.join("|").toString());
}
});
Note:
ruleLookUp[event.rule.name] – returns rules abbreviation
join(“|”).toString() – converts array into pipe separated string to cater list props
localStorage.setItem – put rules fired after send beacon rule into local Storage
6. Now, go to your rule which sends page load beacon on every page e.g. “All Pages | Window Loaded | AA – Send Beacon”
7. Go to that rule > Actions > Set Variable – Adobe Analytics > Open Editor and paste the below snippet
s.prop1=ruleCompleted.join("|").toString();
s.prop2=ruleConditionFailed.join("|").toString();
localStorage.removeItem("ruleCompleted");
localStorage.removeItem("ruleConditionFailed");
ruleCompleted = [];
ruleConditionFailed = [];
8. Add these changes to your library > Build and Publish it. And we are DONE from Launch configurations POV.
3. Adobe Analytics configurations
1. Create Classifications reports on the list props e.g. You can add/remove classification reports as per your needs.
2. Download the classification template and fill it using Tagtician export file.
3. Upload the file using Browser Import and check the reports after some time.
4. Now you can run classification reports to pull some cool insights.
Note: Here data is tiny as this POC was done on a sandbox account.
5. Now, a similar exercise can be done for other prop (prop2) “Rules failed over conditions” like creating classification reports and uploading data.
And that’s it, we are done. Yay!
I hope you enjoyed learning on how to track Launch rules in Adobe Analytics, let us know if you have any questions by mailing us at info@softcrylic.com.