Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google analytics on heroku. How to make it track both <APPNAME>.herokuapp.com and <APPNAME>.com

I have two domains APPNAME.herokuapp.com and APPNAME.com . I just set up APPNAME. I would like to set up google analytics in such a way that it tracks both domains as the same. In other words, I'd like to prevent "losing" any page views. If 20 people view APP.com and 10 people view APPNAME.herokuapp.com , I would like to see this as 30 views in google analytics.

How do I need to change the tracking code GA provides?

like image 969
Alexander Putilin Avatar asked Feb 03 '15 14:02

Alexander Putilin


1 Answers

You simply have to use setdomainname option in GA tracking code - everything you have to know is described here with pretty good examples https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#multipleDomains

like image 87
Łukasz Rysiak Avatar answered Oct 11 '22 15:10

Łukasz Rysiak