This lab will teach you how to run A/B testing using Google Analytics. This is a fundamental skill for testing user behavior on the web, and assignment 8, and especially assignment 9 includes these tasks!
gtag("send", "event", "friendsuggestion", "dismiss"); gtag("send", "event", "friendsuggestion", "accept"); gtag("send", "event", "humankind", "destroy"); gtag("send", "event", <Category>, <Action>);
Install pageview analytics on your portfolio.
Where do I get my code again if I've lost it?
Use the instructions on the next slide.
How do I know my code is being included?
My code is included but I'm still not seeing the collect message in the Network tab.
A zealous Adblock sometimes blocks messages to google analytics. Try disabling your adblock plugin for the duration of this lab if you have one.
Run an A/B test on a minimalist vs. the old vertical layout
It says "Cannot GET /viewAlt"
Did you add the route in app.js? (See Prev Slide)
How do I register a user click?
Check back to Lab 3 slide about how listening to clicks
How do I add the Google Analytics event?
Remember back from slide 9-Store any kind of event on the form of
gtag("send", "event", <Category>, <Action>);
'click'and place it in the click event handler.
How do I clear my cookies so I can see an alternate version of the site?
You can do this by going to google chrome's settings, Show Advanced Settings→Content settings→All Cookies and Site Data. From there, search your heroku URL and Remove the cookie, like below.
This is a lot of work. Is there a better way?
In fact, yes! You could simply open an incognito window and it won't save cookies.
Include analytic tracking for user timing.