Drive More Traffic, Increase Website Traffic with SEODrive More Traffic, Increase Website Traffic with SEO

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Little Celebrities on Campus Who Will Change College Life | By Reid Zura | Starship Technologies | June 2023

    June 5, 2023

    Inclusiveness in Practice: Starship Technologies Proudly Deployed in LA | By Reid Zura | Starship Technologies | June 2023

    June 1, 2023

    Global Accessibility Awareness Day: Building Accessibility into Technology | By Ed Lovelock | Starship Technologies | May 2023

    May 18, 2023
    Facebook Twitter Instagram
    • Home
    • Contact us
    • DMCA
    • Privacy Policy
    Facebook Twitter Instagram
    Drive More Traffic, Increase Website Traffic with SEODrive More Traffic, Increase Website Traffic with SEO
    • Home
    • News

      Little Celebrities on Campus Who Will Change College Life | By Reid Zura | Starship Technologies | June 2023

      June 5, 2023

      Inclusiveness in Practice: Starship Technologies Proudly Deployed in LA | By Reid Zura | Starship Technologies | June 2023

      June 1, 2023

      Global Accessibility Awareness Day: Building Accessibility into Technology | By Ed Lovelock | Starship Technologies | May 2023

      May 18, 2023

      Providing a greener future.On this Earth Day, we encourage… | Redete Nardos | | 11/12/2018 Starship Technologies | April 2023

      April 21, 2023

      Starship Technologies Sets New World Record with 10 Million Kilometers | Reed Zula | | Starship Technologies | April 2023

      April 3, 2023
    • SEO
      1. Backlinks
      2. Google SEO
      3. Local SEO
      4. View All

      Valentine’s Day Marketing Ideas for 2023

      February 2, 2023

      How important will backlinks be in 2023?

      February 2, 2023

      How Google keeps spam out of search results and what it means for SEO

      February 2, 2023

      Summari pivots to AI-generated link previews that you actually click TechCrunch

      February 1, 2023

      Yandex may have previously duplicated Google’s SEO code / Digital Information World

      February 2, 2023

      Google recommends managing credit links footer links for Nofollowing sites

      February 1, 2023

      Google says spam links from porn sites aren’t a priority

      January 31, 2023

      ChatGPT must teach students editors (opinion)

      January 31, 2023

      Daxko Releases UpLaunch ASAP Website Builder to Empower Health and Fitness Professionals

      February 2, 2023

      GoAds.com Founder Nick Kohlschreiber explains how to get the most out of your digital media platform

      February 1, 2023

      GoAds.com Founder Nick Kohlschreiber explains how to get the most out of your digital media platform

      February 1, 2023

      Agencies are using ChatGPT. is that wrong?

      January 31, 2023

      Moss Bros chose agency for organic search strategy after searches doubled during test period

      February 2, 2023

      Terms of Service (TOR) AdOps and SEO Specialist (Personal Consultant)

      February 2, 2023

      Google’s search quality raters protest against pay hikes

      February 2, 2023

      Search and Social: Two Ways to Optimize Your Online Presence

      February 2, 2023
    • Off Page Seo

      How to Double Your Startup Website Traffic: Proven Strategies

      January 27, 2023

      The SEO services market is booming all over the world

      January 26, 2023

      Freelancer SEO Services Market 2023

      January 23, 2023

      Why is My Website Not Getting Traffic?

      January 21, 2023

      How To Get Relevant Backlinks Without Doing Any Work.

      January 20, 2023
    • On Page Seo
      1. Seo Company
      2. View All

      Founder of Calgary SEO firm excited to cut costs for clients with cutting-edge solutions

      February 1, 2023

      JEMSU Miami’s Holistic Approach to Digital Marketing Helps Businesses Succeed in a Highly Competitive Marketplace

      February 1, 2023

      Digital marketing services in Dubai give businesses the web presence they want – News

      February 1, 2023

      Optimize for multiple cities without sacrificing SEO

      January 31, 2023

      Founder of Calgary SEO firm excited to cut costs for clients with cutting-edge solutions

      February 1, 2023

      JEMSU Miami’s Holistic Approach to Digital Marketing Helps Businesses Succeed in a Highly Competitive Marketplace

      February 1, 2023

      Digital marketing services in Dubai give businesses the web presence they want – News

      February 1, 2023

      Optimize for multiple cities without sacrificing SEO

      January 31, 2023
    • SEO Services

      Premier SEO Consultant in Las Vegas, Nevada with Unparalleled Customer Service

      February 2, 2023

      The Battle Against Blockers: Actual SEO Media, Inc. Shows How to Combat Ad-Blocking Software with SEO

      February 2, 2023

      Digital advertising market size expected to reach $209 billion by 2027

      February 1, 2023

      GrindstoneX’s 10 Pioneering Startups: Empowering Women in Tech

      February 1, 2023

      Aurora Legal Marketing Facilitates SEO to Personal Injury Lawyers

      January 31, 2023
    • Website Traffic

      Stock Market | Stock Market FinancialContent Business Page

      February 2, 2023

      What should India’s EdTech industry prioritize in 2023?

      February 2, 2023

      Jacinda Ardern’s resignation is not a lesson in gender politics

      February 2, 2023

      Why Your Business Should Care About SEO

      February 2, 2023

      5 Ways to Use User-Generated Content in Marketing

      February 2, 2023
    Drive More Traffic, Increase Website Traffic with SEODrive More Traffic, Increase Website Traffic with SEO
    Competitor backlink analysis with Python [Complete Script]

    Competitor backlink analysis with Python [Complete Script]

    Drive More TrafficBy Drive More TrafficMay 31, 2022No Comments6 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    In our last article, we analyzed backlinks using data from Ahrefs.

    This time, using the same Ahrefs data source for comparison, we included competitor backlinks in our analysis.

    As before, we defined the SEO value of a site’s backlinks as a product of quality and quantity.

    Quality is the domain authority (or Ahrefs equivalent domain rating) and quantity is the number of referring domains.

    Again, we use the available data to assess link quality before assessing quantity.

    time to code.

    import re
    import time
    import random
    import pandas as pd
    import numpy as np
    import datetime
    from datetime import timedelta
    from plotnine import *
    import matplotlib.pyplot as plt
    from pandas.api.types import is_string_dtype
    from pandas.api.types import is_numeric_dtype
    import uritools  
    
    pd.set_option('display.max_colwidth', None)
    %matplotlib inline
    root_domain = 'johnsankey.co.uk'
    hostdomain = 'www.johnsankey.co.uk'
    hostname="johnsankey"
    full_domain = 'https://www.johnsankey.co.uk'
    target_name="John Sankey"

    Data import and cleaning

    I have set up a file directory to read multiple Ahrefs exported data files in one folder. This is much faster, less tedious, and more efficient than reading each file individually.

    Especially when there are 10 or more!

    ahrefs_path="data/"

    You can use the OS module’s listdir( ) function to list all files in a subdirectory.

    ahrefs_filenames = os.listdir(ahrefs_path)
    ahrefs_filenames.remove('.DS_Store')
    ahrefs_filenames
    
    File names now listed below:
    
    ['www.davidsonlondon.com--refdomains-subdomain__2022-03-13_23-37-29.csv',
     'www.stephenclasper.co.uk--refdomains-subdoma__2022-03-13_23-47-28.csv',
     'www.touchedinteriors.co.uk--refdomains-subdo__2022-03-13_23-42-05.csv',
     'www.lushinteriors.co--refdomains-subdomains__2022-03-13_23-44-34.csv',
     'www.kassavello.com--refdomains-subdomains__2022-03-13_23-43-19.csv',
     'www.tulipinterior.co.uk--refdomains-subdomai__2022-03-13_23-41-04.csv',
     'www.tgosling.com--refdomains-subdomains__2022-03-13_23-38-44.csv',
     'www.onlybespoke.com--refdomains-subdomains__2022-03-13_23-45-28.csv',
     'www.williamgarvey.co.uk--refdomains-subdomai__2022-03-13_23-43-45.csv',
     'www.hadleyrose.co.uk--refdomains-subdomains__2022-03-13_23-39-31.csv',
     'www.davidlinley.com--refdomains-subdomains__2022-03-13_23-40-25.csv',
     'johnsankey.co.uk-refdomains-subdomains__2022-03-18_15-15-47.csv']

    Once the files are listed, use a for loop to read each file individually and append them to the dataframe.

    While reading the file, use string manipulation to create a new column with the site name of the data you want to import.

    ahrefs_df_lst = list()
    ahrefs_colnames = list()
    
    for filename in ahrefs_filenames:
        df = pd.read_csv(ahrefs_path + filename)
        df['site'] = filename
        df['site'] = df['site'].str.replace('www.', '', regex = False)    
        df['site'] = df['site'].str.replace('.csv', '', regex = False)
        df['site'] = df['site'].str.replace('-.+', '', regex = True)
        ahrefs_colnames.append(df.columns)
        ahrefs_df_lst.append(df)
    
    ahrefs_df_raw = pd.concat(ahrefs_df_lst)
    ahrefs_df_raw
    ahrefs dofollow raw data

    Images by Ahrefs, May 2022

    Now the raw data for each site has been combined into a single dataframe. The next step is to organize the column names to make them easier to work with.

    You could use custom functions or list comprehensions to eliminate the repetition, but for novice SEO Pythonistas, it’s a good idea to see what’s going on step by step. As they say, “repetition is the mother of mastery” so practice!

    competitor_ahrefs_cleancols = ahrefs_df_raw
    competitor_ahrefs_cleancols.columns = [col.lower() for col in competitor_ahrefs_cleancols.columns]
    competitor_ahrefs_cleancols.columns = [col.replace(' ','_') for col in competitor_ahrefs_cleancols.columns]
    competitor_ahrefs_cleancols.columns = [col.replace('.','_') for col in competitor_ahrefs_cleancols.columns]
    competitor_ahrefs_cleancols.columns = [col.replace('__','_') for col in competitor_ahrefs_cleancols.columns]
    competitor_ahrefs_cleancols.columns = [col.replace('(','') for col in competitor_ahrefs_cleancols.columns]
    competitor_ahrefs_cleancols.columns = [col.replace(')','') for col in competitor_ahrefs_cleancols.columns]
    competitor_ahrefs_cleancols.columns = [col.replace('%','') for col in competitor_ahrefs_cleancols.columns]

    Having a count column and a single value column (“project”) is useful for grouping and aggregation operations.

    competitor_ahrefs_cleancols['rd_count'] = 1
    competitor_ahrefs_cleancols['project'] = target_name
    
    competitor_ahrefs_cleancols
    Ahrefs Competitor DataImages by Ahrefs, May 2022

    Now that the columns have been cleaned up, it’s time to clean up the row data.

    competitor_ahrefs_clean_dtypes = competitor_ahrefs_cleancols

    For the reference domain, we replace hyphens with zeros and set the data type as integer (that is, integer).

    This is repeated for linked domains as well.

    competitor_ahrefs_clean_dtypes['dofollow_ref_domains'] = np.where(competitor_ahrefs_clean_dtypes['dofollow_ref_domains'] == '-',
                                                               0, competitor_ahrefs_clean_dtypes['dofollow_ref_domains'])
    competitor_ahrefs_clean_dtypes['dofollow_ref_domains'] = competitor_ahrefs_clean_dtypes['dofollow_ref_domains'].astype(int)
    
    
    
    # linked_domains
    
    competitor_ahrefs_clean_dtypes['dofollow_linked_domains'] = np.where(competitor_ahrefs_clean_dtypes['dofollow_linked_domains'] == '-',
                                                               0, competitor_ahrefs_clean_dtypes['dofollow_linked_domains'])
    competitor_ahrefs_clean_dtypes['dofollow_linked_domains'] = competitor_ahrefs_clean_dtypes['dofollow_linked_domains'].astype(int)

    first look indicates the date point at which the link was found. It can be used for plotting time series and deriving link ages.

    Convert to date format using to_datetime function.

    # first_seen
    competitor_ahrefs_clean_dtypes['first_seen'] = pd.to_datetime(competitor_ahrefs_clean_dtypes['first_seen'], 
                                                                  format="%d/%m/%Y %H:%M")
    competitor_ahrefs_clean_dtypes['first_seen'] = competitor_ahrefs_clean_dtypes['first_seen'].dt.normalize()
    competitor_ahrefs_clean_dtypes['month_year'] = competitor_ahrefs_clean_dtypes['first_seen'].dt.to_period('M')
    
    

    To calculate link_age , subtract the date first seen from today’s date and convert the difference to a number.

    # link age
    competitor_ahrefs_clean_dtypes['link_age'] = dt.datetime.now() - competitor_ahrefs_clean_dtypes['first_seen']
    competitor_ahrefs_clean_dtypes['link_age'] = competitor_ahrefs_clean_dtypes['link_age']
    competitor_ahrefs_clean_dtypes['link_age'] = competitor_ahrefs_clean_dtypes['link_age'].astype(int)
    competitor_ahrefs_clean_dtypes['link_age'] = (competitor_ahrefs_clean_dtypes['link_age']/(3600 * 24 * 1000000000)).round(0)

    The target column helps distinguish between “client” sites and competitors which will help you visualize them later.

    competitor_ahrefs_clean_dtypes['target'] = np.where(competitor_ahrefs_clean_dtypes['site'].str.contains('johns'),
                                                                                                1, 0)
    competitor_ahrefs_clean_dtypes['target'] = competitor_ahrefs_clean_dtypes['target'].astype('category')
    
    competitor_ahrefs_clean_dtypes
    Ahrefs clean data typesImages by Ahrefs, May 2022

    Now that your data has been cleaned up in terms of both column titles and row values, you’re ready to set it up and start analyzing.

    link quality

    Start with link quality. It accepts Domain Rating (DR) as a basis.

    Let’s start by examining the distributional properties of DR by plotting the distribution using the geom_bokplot function.

    comp_dr_dist_box_plt = (
        ggplot(competitor_ahrefs_analysis.loc[competitor_ahrefs_analysis['dr'] > 0], 
               aes(x = 'reorder(site, dr)', y = 'dr', colour="target")) + 
        geom_boxplot(alpha = 0.6) +
        scale_y_continuous() +   
        theme(legend_position = 'none', 
              axis_text_x=element_text(rotation=90, hjust=1)
             ))
    
    comp_dr_dist_box_plt.save(filename="images/4_comp_dr_dist_box_plt.png", 
                               height=5, width=10, units="in", dpi=1000)
    comp_dr_dist_box_plt
    Competitive distribution typeImages by Ahrefs, May 2022

    The plot compares the statistical properties of the sites side by side, most notably the interquartile range showing where the most referring domains fall in terms of domain ratings.

    It also has the fourth highest median domain rating for John Sankey, which compares well with the quality of its links when compared to other sites.

    William Garvey shows that the range of DRs is the most diverse compared to other domains, with slightly relaxed criteria for link acquisition. who knows.

    link volume

    That’s quality. What about the number of links from the referring domain?

    To tackle this, we use the groupby function to compute a running total of the reference domain.

    competitor_count_cumsum_df = competitor_ahrefs_analysis
    
    competitor_count_cumsum_df = competitor_count_cumsum_df.groupby(['site', 'month_year'])['rd_count'].sum().reset_index()

    Extensions allow the calculation window to grow according to the number of rows, which is how a running total is achieved.

    competitor_count_cumsum_df['count_runsum'] = competitor_count_cumsum_df['rd_count'].expanding().sum()
    
    competitor_count_cumsum_df
    Ahrefs cumulative total dataImages by Ahrefs, May 2022

    The result is a data frame with site, month_year, and count_runsum (running total), perfect format for feeding charts.

    competitor_count_cumsum_plt = (
        ggplot(competitor_count_cumsum_df, aes(x = 'month_year', y = 'count_runsum', 
                                               group = 'site', colour="site")) + 
        geom_line(alpha = 0.6, size = 2) +
        labs(y = 'Running Sum of Referring Domains', x = 'Month Year') + 
        scale_y_continuous() + 
        scale_x_date() +
        theme(legend_position = 'right', 
              axis_text_x=element_text(rotation=90, hjust=1)
             ))
    competitor_count_cumsum_plt.save(filename="images/5_count_cumsum_smooth_plt.png", 
                               height=5, width=10, units="in", dpi=1000)
    
    competitor_count_cumsum_plt
    Competitor graph Images by Ahrefs, May 2022

    The plot shows the number of referring domains for each site since 2014.

    I find it very interesting that different sites start getting links differently.

    For example, William Garvey started with over 5,000 domains. I want to know where the PR company is!

    You can also see the growth rate. Hadley Rose, for example, started earning the rink in 2018, but he really started moving in mid-2021.

    more more more

    You can always do more scientific analysis.

    For example, one direct and natural extension of the above is to combine both quality (DR) and quantity (volume) to get a more holistic view of how sites compare in terms of offsite SEO. .

    Other extensions model the quality of referring domains on both your site and your competitors’ sites so that what link features (such as word count and link content relevance) can explain the difference in visibility between yours and your competitors’ is to check whether .

    This model extension will be a great application of these machine learning techniques.

    Other resources:


    Featured Image: F8 Studio/Shutterstock





    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Drive More Traffic
    • Website

    Related Posts

    Valentine’s Day Marketing Ideas for 2023

    February 2, 2023

    How important will backlinks be in 2023?

    February 2, 2023

    How Google keeps spam out of search results and what it means for SEO

    February 2, 2023

    Leave A Reply Cancel Reply

    Demo
    Don't Miss

    Little Celebrities on Campus Who Will Change College Life | By Reid Zura | Starship Technologies | June 2023

    News June 5, 2023

    Inclusiveness in Practice: Starship Technologies Proudly Deployed in LA | By Reid Zura | Starship Technologies | June 2023

    June 1, 2023

    Global Accessibility Awareness Day: Building Accessibility into Technology | By Ed Lovelock | Starship Technologies | May 2023

    May 18, 2023

    Providing a greener future.On this Earth Day, we encourage… | Redete Nardos | | 11/12/2018 Starship Technologies | April 2023

    April 21, 2023
    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo
    Our Picks

    Little Celebrities on Campus Who Will Change College Life | By Reid Zura | Starship Technologies | June 2023

    June 5, 2023

    Inclusiveness in Practice: Starship Technologies Proudly Deployed in LA | By Reid Zura | Starship Technologies | June 2023

    June 1, 2023

    Global Accessibility Awareness Day: Building Accessibility into Technology | By Ed Lovelock | Starship Technologies | May 2023

    May 18, 2023

    Providing a greener future.On this Earth Day, we encourage… | Redete Nardos | | 11/12/2018 Starship Technologies | April 2023

    April 21, 2023
    Demo
    About Us

    Drive More Traffic is an online resource that helps you get more traffic to your website. We offer a wide range of tools and resources, such as blog posts, webinars, live webinars, SEO tutorials, and much more. This website also has a blog with articles on a variety of topics related to SEO and web design.

    Facebook Twitter Pinterest YouTube WhatsApp
    Our Picks

    Little Celebrities on Campus Who Will Change College Life | By Reid Zura | Starship Technologies | June 2023

    June 5, 2023

    Inclusiveness in Practice: Starship Technologies Proudly Deployed in LA | By Reid Zura | Starship Technologies | June 2023

    June 1, 2023

    Global Accessibility Awareness Day: Building Accessibility into Technology | By Ed Lovelock | Starship Technologies | May 2023

    May 18, 2023

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    © drivemoretraffic. Designed by drivemoretraffic.
    • Home
    • Contact us
    • DMCA
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.