To pass A/B test variation name into a Google Analytics event to track impact of A/B tests , It is needed to create an HTML offer inside Adobe Target and then in that offer we can write the JS code to pass data to Google Analytics and then apply the offer to an Experience inside an Activity (Campaign) . Please follow the below steps to achieve the same :
- Login to Adobe Target
- Add a new HTML Offer (Offers > Create > HTML Offer)
- Name the offer say "Testing Offer" configure and paste in the JavaScript code (with the tags intact)
NOTE: You may customize the below Google Analytics code as per your need. Here’s the script:
<script type="text/javascript"> alert("Your Campaign name is " + '${campaign.name}' + " :Your Experience name is "+ '${campaign.recipe.name}'+" :Your campaign Id is "+'${campaign.id}' +" :Your Experience ID is "+ '${campaign.recipe.id}' + " :Your Experience Traffic Type is "+'${campaign.recipe.trafficType}'); var sCampaignName='${campaign.name}'; var sExperienceName = '${campaign.recipe.name}'; _gaq.push(['_setCustomVar',1,'Target' + sCampaignName,sExperienceName,1]); _gaq.push(['_trackEvent','Target',sCampaignName,sExperienceName,undefined,true]); </script>
- If using Form Based Experience Composer then Please click "Content" arrow ">" inside the experience to apply the offer to experience
- If using Visual Experience Composer, Once the Page Loads in an Experience , When you click on a page element which you want to replace with the offer , a menu shows the options that are available for that element type. Click Swap Offer and then select the the offer say "Testing Offer" from content / Offer library.
- For Validation & Testing , we have put alert in offer created above & output will be similar to the snapshot shown below