• I have 3 domains. I want all of them to point to one website. However, I need the site indexed in respective domains on searches. Like domain1.com/post-title-123 should be the same as domain12.com/post-title-123 and domain13.com/post-title-123 but indexed as if they were different sites.

    Then comes another concern, what about Google analytics, these tracking codes are domain-specific. How to use the right analytics code based on a domain?

    • This topic was modified 2 years, 6 months ago by Yui. Reason: moved to fixing wordpress
Viewing 4 replies - 1 through 4 (of 4 total)
  • I need the site indexed in respective domains on searches. Like domain1.com/post-title-123 should be the same as domain12.com/post-title-123 and domain13.com/post-title-123 but indexed as if they were different sites.

    You may get duplicate content penalty.

    If that’s fine with you, you can search in the plug-in directory for “multiple domain”
    https://www.ads-software.com/plugins/search/multiple+domain/

    For example, the Multiple Domain plug-in can do this
    https://www.ads-software.com/plugins/multiple-domain/

    Then comes another concern, what about Google analytics, these tracking codes are domain-specific. How to use the right analytics code based on a domain?

    This is a bit tricky.

    You want to create a tracking code for each domain, which will give you a unique UA-xxxxxx-1 inside each tracking script.

    Then, you want to make the site dynamically switch between the different unique tracking scripts depending on the domain being visited.

    You can probably do this with a shortcode plug-ins, but there doesn’t seem to be any that support this “switching between different text based on domain” out of the box. So you may want to combine shortcode plug-in with some custom js coding.

    You might need to recruit the help of freelancers to do this part for you.

    It can be done with a headless website. You would have to feed information through the REST API and use a software package like Gatsby to read and display the information. It would take some serious programming. But, It could be done.

    I would like to add to the solution that I mentioned above. For the Google Analytics tracking code part, there may not be a need for freelancers if you can follow the instructions below with the use of a JS code snippet plug-in. I’ve developed a script that you can use.

    Step 1:

    Get a plug-in that allows you to insert a JS code snippet such as

    CSS & JavaScript Toolbox
    https://www.ads-software.com/plugins/css-javascript-toolbox/

    Step 2:

    Follow the first example of the video tutorial in the plug-in page above to insert a Google Analytics tracking code snippet.

    In the code area, insert the following:

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
    <script>
       window.dataLayer = window.dataLayer || [];
       function gtag(){window.dataLayer.push(arguments);}
       gtag('js', new Date());
    
       gtag('config', 'GA_MEASUREMENT_ID');
    </script>
    
    <script>
    switch( window.location.hostname )
    {
       case "domain1.com":
          document.head.innerHTML = document.head.innerHTML.replace(/GA_MEASUREMENT_ID/g, 'GA_MEASUREMENT_ID_FOR_DOMAIN_1');
       break;
    	
       case "domain2.com":
          document.head.innerHTML = document.head.innerHTML.replace(/GA_MEASUREMENT_ID/g, 'GA_MEASUREMENT_ID_FOR_DOMAIN_2');
       break;
    
       case "domain3.com":
          document.head.innerHTML = document.head.innerHTML.replace(/GA_MEASUREMENT_ID/g, 'GA_MEASUREMENT_ID_FOR_DOMAIN_3');
       break;
    	
       default:
       break;
    }
    </script>

    Step 3:

    In the above code, replace each of

    case "domain1.com" and GA_MEASUREMENT_ID_FOR_DOMAIN_1
    case "domain2.com" and GA_MEASUREMENT_ID_FOR_DOMAIN_2
    case "domain3.com" and GA_MEASUREMENT_ID_FOR_DOMAIN_3

    with the actual domain and the actual Google Analytics tracking code GA_MEASUREMENT_ID for each domain.

    If you were able to solve your issues, it’s a good practice to mark this topic as “Resolved” per forum guidelines.

    You can do this using the “Status” drop-down menu located on the right sidebar of this page.

    In addition, this can help out other users.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘1 site through 3 domains, possible?’ is closed to new replies.