I’m trying to save time by creating HubSpot native reports on 1) Top-10 blog posts by number of views last month, shown as a grid of blog post featured image + view count + blog post title underneath, 2 rows 5 posts per row; and #2) Top-20 all-time blog posts by views, shown as a column chart. So far I’ve done this manually using PowerPoint, looking at stats via HS OOTB analytics reports on blog posts.
a) It seems like it’s not possible to use the analytics space to produce a column chart of #2, let alone produce 1.
b) I’ve tried the HubSpot-provided post_listing.module, but the output differs from the HS traffic analytics default blog post analytics view: Traffic Analytics --> Pages --> Page type: blog posts, order by views). And, as written under 1, I’d like to modify this to include featured images and the view count.
c) HubSpot custom report building doesn’t provide variables such as “view count” for blog posts. I can only see the “count of blogs” and “count of campaigns” default measures
d) I can use the “blog_popular_posts” to produce #2 and those seem to oddly be ordered by the view count, but I’d like to make it a column chart. And, even as a list type view, i cannot add view counts to each row. Here’s what I’ve tried:
{% set pop_posts = blog_popular_posts(“default”, 10, [], “popular_past_month”, “OR”) %}
{% for pop_post in pop_posts %}
<div class=“post-title”>{{ pop_post.name }}, {{pop_post.views}}</div>
{% endfor %}
(I realize the pop_post.views doesn’t exist, was a best guess)
e) I found this page:
and understood that one can issue an API call to fetch the views per one blog post like this:
“GET analytics/v2/reports/blog-posts/content-group/:blog_id/sources/:time_period”
…but i) this seems a bit more complicated as I’d need to fetch info on all posts, sort them using a self-built sorting function (?), then display the results to at least get to 1, but not sure if I can produce a column chart for #2.
Am I even close to the right answer? Is it possible to get to what I’m trying to achieve? I’m tired of the manual process of:
a) Fetching top 10 blog posts last month from HS traffic analytics
b) Snipping featured images from each of those blog posts, adding title + view count manually to a powerpoint slide.
Any help much appreciated!
