diff --git a/app/black_box/google_analytics.rb b/app/black_box/google_analytics.rb
index 6a32c6bfb..92e243e76 100644
--- a/app/black_box/google_analytics.rb
+++ b/app/black_box/google_analytics.rb
@@ -17,7 +17,7 @@ class GoogleAnalytics
def get_pageviews
requests = @article_ids.map do |id|
article = Article.find_by_id(id)
- make_report_request("ga:pagePath==#{article.path}", "ga:pageviews")
+ make_report_request("ga:pagePath=@#{article.slug}", "ga:pageviews")
end
pageviews = fetch_all_results(requests)
@article_ids.zip(pageviews).to_h
@@ -82,4 +82,4 @@ class GoogleAnalytics
scope: [AUTH_ANALYTICS_READONLY],
)
end
-end
\ No newline at end of file
+end
diff --git a/app/labor/article_analytics_fetcher.rb b/app/labor/article_analytics_fetcher.rb
index 8982dd8d7..151c91a4f 100644
--- a/app/labor/article_analytics_fetcher.rb
+++ b/app/labor/article_analytics_fetcher.rb
@@ -1,4 +1,8 @@
class ArticleAnalyticsFetcher
+ def initialize(context = "default")
+ @context = context
+ end
+
def update_analytics(user_id)
articles_to_check = Article.where(user_id: user_id, published: true)
qualified_articles = get_articles_that_qualify(articles_to_check)
@@ -29,6 +33,7 @@ class ArticleAnalyticsFetcher
end
def should_fetch(article)
+ return true if @context == "force"
article.positive_reactions_count > article.previous_positive_reactions_count
end
-end
\ No newline at end of file
+end
diff --git a/app/views/dashboards/_dashboard_article.html.erb b/app/views/dashboards/_dashboard_article.html.erb
index 9a223b424..c7cf221ae 100644
--- a/app/views/dashboards/_dashboard_article.html.erb
+++ b/app/views/dashboards/_dashboard_article.html.erb
@@ -8,7 +8,7 @@
DELETE
<% if article.published && current_user.can_view_analytics? %>
- <%= article.page_views_count > 100 ? article.page_views_count : "under 100" %> views // <%= article.positive_reactions_count %> reactions
+ <%= article.page_views_count > 100 ? article.page_views_count : "under 100" %> views // <%= article.positive_reactions_count %> reactions // <%= article.comments_count %> comments
<% end %>
diff --git a/app/views/dashboards/show.html.erb b/app/views/dashboards/show.html.erb
index ffc6acab9..42b264afd 100644
--- a/app/views/dashboards/show.html.erb
+++ b/app/views/dashboards/show.html.erb
@@ -27,9 +27,7 @@
<% end %>
<% if @user.org_admin && @user.organization && params[:which] == "organization" %>
- <% if current_user.can_view_analytics? %>
- <%= render "analytics" %>
- <% end %>
+ <%= render "analytics" %>
<% @articles.each do |article| %>
<%= render "dashboard_article", article: article, org_admin: true %>
<% end %>
@@ -50,9 +48,7 @@
<% end %>
<% end %>
<% elsif @articles.any? %>
- <% if current_user.can_view_analytics? %>
- <%= render "analytics" %>
- <% end %>
+ <%= render "analytics" %>
<% if current_user.has_role?(:video_permission) %>
Upload a Video 🎥