1

I have a webpage with campaigns that are only valid for a specific period of time. My problem is that when a campaign is active, the homepage redirects to the campaign page and therefore the Google search result for the website shows the information from the campaign page.

At the moment I am doing the redirect only when there is no referer. This way once the user clicks the logo of the webpage they see the normal home page and not the campaign anymore.

The other problem is that Google bots do not include referer, so whey will always land on the campaign page when one is active.

I would like to tell the bots to skip the campaign and just index the home, but I think they cannot see the home page because of the redirect that I am doing.

Maybe I should use a different logic for the landing (campaign) pages? I thought about the following: having domain.com and domain.com/home. Then domain.com would redirect to the campaign when one is active, but domain.com/home would always just open home. Then I can set domain.com, domain.com/home and domain.com/campaigns/1 with canonical to domain.com. Would this be better?

To put it simple I need a way to tell Google to index my home page no matter if I have active campaigns or not and just skip the campaign pages.

4
  • Google wants to index the page the user will see when they click on the link from Google's Search Page, which is without a referrer. Delivering different content to Search Engines is associated with spamming - don't want to go there. Have you considered using an Iframe on your home page? Javascript could then decide when that iframe is displayed or when the content of the home page is displayed and google can see both.
    – Wayne
    May 29 at 16:10
  • In other words, create the content on the front end, browser side, not the back end, server side. If you hate iframes it could be done using a javascript fetch into a divide depending on conditions, IE session cookie or local referrer
    – Wayne
    May 29 at 16:16
  • It should be noted that google will look at the javascript and should render the page, (verify this in the search.google.com/search-console) in your case it will be the event info on your home page. Frequent updates to your home page are a good thing and google will attempt to keep up with your schedule of updates. IE what new event, which for you is just changing the URL to be fetched.
    – Wayne
    May 29 at 16:25
  • You may also want to consider using the methods provided for indexing deep content as if you have a paywall. Thus something like developers.google.com/search/docs/advanced/structured-data/… is placed on your home page and if they don't have a referrer do the javascript redirect. This will help index the home page and allow you to put in a title and description for the homepage.
    – Wayne
    May 29 at 16:48

1 Answer 1

1

Here is a basic template. Following Google guidelines of not cloaking content and informing Google to index the page as deep content, which it is.

<html>
  <head>
    <title>My Site Title</title>
    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "WebPage",
      "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://example.org/"
      },
      "headline": "Page Headline",
      "image": "https://example.org/thumbnail1.jpg",
      "publisher": {
         "name": "My Site",
         "@type": "Organization",
         "logo": {
            "@type": "ImageObject",
            "url": "https://example.org/logo.jpg"
         }
      },
      "description": "A most wonderful information",
      "isAccessibleForFree": "true",
      "hasPart":
        {
        "@type": "WebPageElement",
        "isAccessibleForFree": "true",
        "cssSelector" : ".refered"
        }
    }
    </script>
    <style>
       .refered {
          display:none;
       }
   </style>
  </head>
  <body>
    <div class="non-refered" id="campaign">it would be proper here to have a link to open deep content 
    </div>
    <div class="refered" id="deep">
      Subscriber content -- IE somebody who followed a link is a subscriber. 
      I want this to show up in search engines as deep content.
    </div>
    
    <script>
    if (document.referrer) {
       document.getElementById("deep").style.display = "block";
    } else {
    fetch("active.html")
       .then(response => response.text())
       .then(html => {
           document.getElementById('campaign').innerHTML = html;
           })
    }
    </script>
  </body>
</html>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.