Add Google AdSense to your Shopify store | Step by Step Guide

Adăugați Google AdSense în magazinul dvs. Shopify | Ghid pas cu pas

What is AdSense?

Google AdSense provides a way for publishers to earn money from their online content. AdSense works by matching ads to your site based on your content and visitors. The ads are created and paid for by advertisers who want to promote their products. Since these advertisers pay different prices for different ads, the amount you earn will vary.

You offer ad spaces on your website, the highest paying ads appear on your offered spaces and then you get paid for that. Simple as that

Even if you run an online store, you may want to add an extra income in your pockets by placing some ads. It does not cost anything to do so and Google`s ads are not even that intrusive and you can choose where and how to appear, or just leave them automated.

Setting everything up

  •  Start off by making an AdSense account, if you do not already have one, by following this link. It is very easy, you just need to provide your site name and some other details like e-mail and country
  • After your account is created you will see some code on the homepage that needs to be inserted on your site. To do so follow the next steps:

 

  • Log into your Shopify store account
  • Click on Online Store
  • For the main theme click on Actions > Edit Code

Shopify Edit code

  • You will be taken to the code editor where you will select theme.liquid file from the left panel
  • Copy the code from the AdSense page and paste it inside the theme.liquid file, right below the <head> tag. It should be on the 3rd or 4th line

Adsense code

    This was all the initial setup necessary. Go back to AdSense page and tell Google you uploaded the code and it will begin the verification process. This means it will verify if your site complies with  their policies, if it has enough content and so on. It typically takes about a few days to a week to process, but it may take longer.

    If your site does get the OK from them, you should start seeing ads on your sites within a few hours.

    However you will get a warning message on your AdSense account page that will tell you  to solve an issue with the ads.txt file, or your income will be affected. You have to upload a file on the root of your site, that has to be accessible on the path https://example.com/ads.txt. This may sound like nothing, but Shopify does not let you upload files/assets like that. All the files and assets are served over cdn (content delivery network), so the route to the file will look different.

    Here is the solution to this issue:

    • Log in to your Shopify store account
    • Go to Settings > Files
    • Take the generated ads.txt file from AdSense
    • Upload the file on Shopify
    • Copy the URL of the file

    ads.txt file uploaded

    • Go to Online Store > Navigation > Url Redirects

    Shopify url redirects

    • Create a redirect rule from /ads.txt to /file_url

    ads.txt redirect route

    • Save

    Now if you go to https://yourShop.com/ads.txt you will see the file. AdSense may however notify you in the future about this issue, but the warnings go away quickly. This is somewhat a workaround, but the only working solution for Shopify so it is normal to get these warnings now and then.

    Final thoughts 

    There are though a few cons for using ads on your website, be it on Shopify or any other platform. 

    The first and most important is that if you do have an actual shop running, those ads might cause customers to leave your website by clicking one of the ads. Think of it this way: you have a shop selling phone cases and while browsing through them, a customer sees an eye-catching ad for another similar product from one of your competitors and clicks on it. You do get paid for the ad click, but you will probably lose the customer if he buys from another site.

    Performance is the second issue. Even if you do have 1-3 ads showing up on each page of your website, they still have to be loaded. That means a few more javascript files and graphics that load at page load or shortly after. This will cost your website  a few good points in terms of page speed load, no matter how optimized it is before adding ads to it.

    Another issue that comes to mind is kind of related to the first one. Having an online store is all about selling your own products and trying to reach out to as many potential customers as one can. It surely is not quite professional to show ads for different stuff among your own products. However if your website is more blog/other content oriented, this will be your only source of income.

    Putting all the pros and cons in a balance, it is up to you to decide if working with AdSense is a good or bad thing to do.

    Find out more about how to balance earnings and performance for your store by reading more in our next article: Make the most out of Google Adsense on your Shopify store

     

     

    2 comments

    Dear Rishabh Choudhary, the changes will take any time from 24 hours to a few days to take effect beforr the warning goes away. For me it took around a week or so.

    Bogdan

    it still shows me the same problem… I have placed the ads.txt file i can’t understand which url i have to redirect to
    my website link is https://iamiitian.com/

    Rishabh Choudhary

    Leave a comment

    Please note, comments need to be approved before they are published.