1

I have a website with 2 domains, let say domain1.com(English) and domain2.se(Swedish). Same content but different languages.

On Google analytics I have this:

-Domain1/Domain2 (Account)

--Domain1 (UA-123456789-1) (Property)

--Domain2 (UA-123456789-2) (Property)

Is that correct to create 2 property, one for each domain?

Now, I want to track visitors on user profile pages. For example, a user visit /user/test and then I want to send the username or user id to google analytics. Later I will see how many visits each profiles has, and I want to get specific profile visits between specific dates. It should not matter if you visit domain1.com/user/test or domain2.se/user/test. I want to get the total number of visits on the profile. Is this possible to do with google analytics or should I use another tool(free) for that? Now, I store the visits in my own db, but I think there is a better way to do this?

This is what i have:

<script type="text/javascript">
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments);
        }, i[r].l = 1 * new Date(); a = s.createElement(o),
        m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m);
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

    ga('create', '[ANALYTICSIDFORCURRENTDOMAIN]', '[CURRENTDOMAIN]');
    ga('send', 'pageview');
</script>

So,

  1. How can I track visits on a profile page?

  2. How can I receive how many visits this profile page has?

4 Answers 4

1

I think there is a much easier ways to do cross domain tracking using Google Tag Manager. You can actually have one profile with either two views or segment with a custom dimension for the language. A google tag manager article on cross Domain Tracking. https://support.google.com/tagmanager/answer/6106951?hl=en. The advantage with this method would be you can track visitors moving across both domains, as the visitor ID would be the same.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanx. But when i create a new property, i can only add one domain. Will there be problem with domain2?
No, I don't think so. I had done this in the past. Though that was on staging environment.
0

sorry, but i can just answer your first question: Yes you must have a property for each domain.

For the other questions, i would use also my own database... But i think too, that there are better ways, to do this.

Greetings

Comments

0

There are several possible solutions for your task.

Option 1: You want to have data for each separate domain and at the same time track profiles in one place(for both domains together). Solution: in addition to current properties create another property(rollup property) which will collect data for both domains. And on each website will be installed 2 GA properties:for this separate domain and for common data(rollup). But this require some GA knowledges and customization of the GA code.

Option 2: You want just collect data for both domains in one place. Then you may use one GA property with filtes, which will extract domain name and paste to "page path" GA parameter. So instead of /user/test(by default) in reports you get domain1.com/user/test and domain2.se/user/test.

3 Comments

Thanx. If i only use one property for all domains, the problem is gone. Can i later create a view and only see the visitors for domain2.se? And how can i send the user id or username of the profile the visitor visit? And how can i recieve number of visits on the specific profile? (The profile has subpages)
I think you can create view where you may filter only visits for domain2.se. "And how can i send the user id or username of the profile the visitor visit?" - there are several GA features you may use for this: like Event tracking or Google Analytics UseID "And how can i recieve number of visits on the specific profile?" - depends on your URL structure and tracking settings.
I try this: ga('create', '[ID]', 'auto', , { 'userId': '[CURRENTUSERID]'}); ga('send', 'pageview'); ga('send', 'event', 'Profile', 'visit'); But how can i set the userid or username for the profile the user is visit? In mixpanel i can set a id, but in Google Analytics?
0

This is a good article for cross domain tracking - http://www.lunametrics.com/blog/2015/06/16/cross-domain-tracking-with-google-tag-manager/

And yes you can make view fo each domain using filters - http://www.lunametrics.com/blog/2015/12/10/basic-google-analytics-filters/?utm_source=ActiveCampaign&utm_medium=email&utm_content=GTM+Weekly%3A+Email+Input+Variable&utm_campaign=Newsletter+%2311+Email+Input+Variable#Include%20Specific%20Hostname

And yes you can send user ID for each hit and page view.

1 Comment

Do you have any example how i can send the user id for the profile the visitor visit?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.