advertools - online marketing productivity and analysis tools
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
.. image:: https://img.shields.io/pypi/v/advertools.svg :target: https://pypi.python.org/pypi/advertools
.. image:: https://img.shields.io/travis/eliasdabbas/advertools.svg :target: https://travis-ci.org/eliasdabbas/advertools
.. image:: https://readthedocs.org/projects/advertools/badge/?version=latest :target: https://advertools.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status
.. image:: http://pepy.tech/badge/advertools :target: http://pepy.tech/project/advertools
.. image:: https://img.shields.io/lgtm/grade/python/g/eliasdabbas/advertools.svg :target: https://lgtm.com/projects/g/eliasdabbas/advertools/context:python
.. image:: https://badges.gitter.im/advertools/community.svg :target: https://bit.ly/3hEWZCe
| 🎊 New:
SEO crawler_ now extracts JSON-LD canonical, alternate href, alternate hreflang, OpenGraph, and Twitter cards if available on pages | 🎉 New:
connecting to Google's Knowledge Graph Data API_ | 🎉 Faster:
downloading & parsing XML sitemaps_ into DataFrames, is much faster now
advertools: productivity & analysis tools to scale your online marketing
| A digital marketer is a data scientist. | Your job is to manage, manipulate, visualize, communicate, understand, and make decisions based on data.
You might be doing basic stuff, like copying and pasting text on spread sheets, you might be running large scale automated platforms with sophisticated algorithms, or somewhere in between. In any case your job is all about working with data.
As a data scientist you don’t spend most of your time producing cool visualizations or finding great insights. The majority of your time is spent wrangling with URLs, figuring out how to stitch together two tables, hoping that the dates, won’t break, without you knowing, or trying to generate the next 124,538 keywords for an upcoming campaign, by the end of the week!
advertoolsis a Python package that can hopefully make that part of your job a little easier.
.. code:: bash
pip install advertools # OR: pip3 install advertools
The most important thing to achieve in SEM is a proper mapping between the three main elements of a search campaign
Keywords (the intention) -> Ads (your promise) -> Landing Pages (your delivery of the promise) Once you have this done, you can focus on management and analysis. More importantly, once you know that you can set this up in an easy way, you know you can focus on more strategic issues. In practical terms you need two main tables to get started:
Keywords: You can
generate keywords_ (note I didn't say research) with the
Ads: There are two approaches that you can use:
ad_create_ function for more details.
ad_from_string_ helps you accomplish that.
Tutorials and additional resources
Setting a full SEM campaign_ for DataCamp's website tutorial
generating SEM keywords with Python_ on DataCamp
Setting up SEM campaigns on a large scale_ tutorial on SEMrush
tool to generate keywords_ online based on the
Probably the most comprehensive online marketing area that is both technical (crawling, indexing, rendering, redirects, etc.) and non-technical (content creation, link building, outreach, etc.). Here are some tools that can help with your SEO
SEO crawler:_ A generic SEO crawler that can be customized, built with Scrapy, & with several features:
robots.txt downloader_ A simple downloader of robots.txt files in a DataFrame format, so you can keep track of changes across crawls if any, and check the rules, sitemaps, etc.
XML Sitemaps downloader / parser_ An essential part of any SEO analysis is to check XML sitemaps. This is a simple function with which you can download one or more sitemaps (by providing the URL for a robots.txt file, a sitemap file, or a sitemap index
SERP importer and parser for Google & YouTube_ Connect to Google's API and get the search data you want. Multiple search parameters supported, all in one function call, and all results returned in a DataFrame
Tutorials and additional resources
serp_googfunction to get
SERP rankings on Google_
analyzing SERPs on a large scale with Python_ on SEMrush
SERP datasets on Kaggle_ for practicing on different industries and use cases
SERP notebooks on Kaggle_ some examples on how you might tackle such data
Content Analysis with XML Sitemaps and Python_
Turkish news sites,
URLs, page titles, tweets, video descriptions, comments, hashtags are some exmaples of the types of text we deal with.
advertoolsprovides a few options for text analysis
Word frequency_ Counting words in a text list is one of the most basic and important tasks in text mining. What is also important is counting those words by taking in consideration their relative weights in the dataset.
word_frequencydoes just that.
URL Analysis_ We all have to handle many thousands of URLs in reports, crawls, social media extracts, XML sitemaps and so on.
url_to_dfconverts your URLs into easily readable DataFrames.
Emoji_ Produced with one click, extremely expressive, highly diverse (3k+ emoji), and very popular, it's important to capture what people are trying to communicate with emoji. Extracting emoji, get their names, groups, and sub-groups is possible. The full emoji database is also available for convenience, as well as an
emoji_searchfunction in case you want some ideas for your next social media or any kind of communication
extract_ functions_ The text that we deal with contains many elements and entities that have their own special meaning and usage. There is a group of convenience functions to help in extracting and getting basic statistics about structured entities in text; emoji, hashtags, mentions, currency, numbers, URLs, questions and more. You can also provide a special regex for your own needs.
Stopwords_ A list of stopwords in forty different languages to help in text analysis.
Tutorial on DataCamp for creating the
word_frequencyfunction and explaining the importance of the difference between
absolute and weighted word frequency_
Text Analysis for Online Marketers_ An introductory article on SEMrush
In addition to the text analysis techniques provided, you can also connect to the Twitter and YouTube data APIs. The main benefits of using
Multiple requests: in YouTube's case you might want to request data for the same query across several countries, languages, channels, etc. You can specify them all in one request and get the product of all the requests in one response
Tutorials and additional resources
A visual tool to
check what is trending on Twitter_ for all available locations
Twitter data analysis dashboard_ with many options
How to use the
Twitter data API with Python_
Extracting entities from social media posts_ tutorial on Kaggle
Analyzing 131k tweets_ by European Football clubs tutorial on Kaggle
An overview of the
YouTube data API with Python_
Function names mostly start with the object you are working on, so you can use autocomplete to discover other options:
kw_: for keywords-related functions |
ad_: for ad-related functions |
url_: URL tracking and generation |
extract_: for extracting entities from social media posts (mentions, hashtags, emoji, etc.) |
emoji_: emoji related functions and objects |
youtube: a module for querying the YouTube Data API and getting results in a DataFrame |
serp_: get search engine results pages in a DataFrame, currently available: Google and YouTube |
crawl: a function you will probably use a lot if you do SEO |
*_to_df: a set of convenience functions for converting to DataFrames (XML sitemaps, robots.txt files, and lists of URLs)