How to use Route53 effectively for online experiments?

As the owner of a product on a site with 2 million unique sites per month, I want to perform some A / B tests that I can track for Google Analytics without paying high commissions for other online testing services. Using Google’s own experimental materials requires redirecting using JS, which I don’t want to jeopardize the loading of page performance and have the right to use more than 5 variations that CE limits you.

This answer sparked my interest in using Route53 to avoid experimenting with Google Content:

Google Analytics Content A / B experiments to test server code without refreshing the page

I would like to know how I can serve and track these options.

As I understand it, Route53 operates at the DNS level and can load traffic balance to different IP addresses, so I could serve mydomain.com 50% / 50% to 200.0.0.1 and 200.0.0.2. I can then use the server-side code to determine the IP address used and to serve a different JS tracking code for Google Analytics.

Then, if users fulfill or do not achieve my GA goal, can I measure the effectiveness of my campaign?

Is this correct or am I missing something in the GA or site settings?

+7
source share
1 answer

If you already use Route53 and do not mind tracking different binding codes separately, you can use the server-side code bit to select the correct tracking code for this identifier. Here is an example in PHP.

<?php var $serverIp_trackingCodes_map = array( '192.168.1.1' => 'UA-XXXXX-1', '192.168.1.2' => 'UA-XXXXX-2', '192.168.1.3' => 'UA-XXXXX-3', '192.168.1.4' => 'UA-XXXXX-4' ); ?> <script type="text/javascript"> //The usual ga tracking code var _gaq = _gaq || []; //Pass in the tracking code for that server _gaq.push(['_setAccount', '<?php echo $serverIp_trackingCodes_map[ $_SERVER["SERVER_ADDR"] ] ?>']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> 

But it would be much easier to use a single tracking code and set a custom variable with the name of the server or ip. This can later be used as a filter in reports.

 <script type="text/javascript"> //The usual ga tracking code var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); //Set the custom variable _gaq.push(['_setCustomVar', 1, 'ServerIP','<? echo $_SERVER["SERVER_ADDR"]?>']); </script> 
+3
source

All Articles