<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nicolas Granja</title>
    <description>The latest articles on DEV Community by Nicolas Granja (@ngranja19).</description>
    <link>https://dev.to/ngranja19</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F385455%2Ff6d38a05-1575-4929-8b40-95300d720ca4.jpg</url>
      <title>DEV Community: Nicolas Granja</title>
      <link>https://dev.to/ngranja19</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ngranja19"/>
    <language>en</language>
    <item>
      <title>How I increased by 3x my ads revenue doing a simple change on my site.</title>
      <dc:creator>Nicolas Granja</dc:creator>
      <pubDate>Tue, 10 Nov 2020 01:22:59 +0000</pubDate>
      <link>https://dev.to/ngranja19/how-i-increased-by-3x-my-ads-revenue-doing-a-simple-change-on-my-site-2nj6</link>
      <guid>https://dev.to/ngranja19/how-i-increased-by-3x-my-ads-revenue-doing-a-simple-change-on-my-site-2nj6</guid>
      <description>&lt;p&gt;I'm going to explaining &lt;strong&gt;how I managed to triplicate my revenue from ads with a pretty simple change on my website that I believe most of you can replicate on your own sites.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Disclaimer: what I actually triplicated was the number of pages per session, which directly affected my ads revenue (you get paid for the number of impressions). To make it clearer, with the same number of visitors I triplicated the number of ads impression, and - before you ask - without adding more ads. Let's see how I did it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pleasant surprise.
&lt;/h2&gt;

&lt;p&gt;A couple of days ago I shared on the subreddit r/India (post &lt;a href="https://www.reddit.com/r/india/comments/ghfme2/list_of_salaries_from_india_to_find_out_if_youre/" rel="noopener noreferrer"&gt;here&lt;/a&gt;) my website knowyourworth.app. That drove a lot of traffic to my site, so I decided to take a look at the analytics. I found that I got 9k+ page views that day, but what it caught my attention was the number of Pages per Session: 7.3.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw2wqlm7prbu3fg1a48na.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw2wqlm7prbu3fg1a48na.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  7.32 pages per session on May 11
&lt;/h6&gt;

&lt;p&gt;Before that day (11th May), that metric was around 2.2, as you can see in the following image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjqvhmcdz120wqm0np8ja.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjqvhmcdz120wqm0np8ja.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  2.22 pages per session the week before
&lt;/h6&gt;

&lt;h2&gt;
  
  
  Finding the reason.
&lt;/h2&gt;

&lt;p&gt;The thing is, that the main page of my site is a big table where you can compare salaries filtering by location, education, experience, job title, and more.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fblxy78b855e5jpdpy73f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fblxy78b855e5jpdpy73f.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Salary comparison page with some filters applied.
&lt;/h6&gt;

&lt;p&gt;Most of my visitors spent most of their time on that page, applying filters and browsing the data using the table pagination.&lt;/p&gt;

&lt;p&gt;A lot of people were asking me if I could show the state of the filters in the URL, so they could copy it and share the search very easily.&lt;/p&gt;

&lt;p&gt;So that's exactly what I did.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjxbgdp2sci6ujc9efjxf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjxbgdp2sci6ujc9efjxf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Filters in the URL
&lt;/h6&gt;

&lt;p&gt;Once it was done, each time someone makes a search, the URL change (without refreshing the page, thanks to VueJs that reuse the component) but it actually counts as a new page, at least for google analytics. Therefore, &lt;strong&gt;with the same number of visitors, I get 3 times more page views.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The (not so) magical change.
&lt;/h2&gt;

&lt;p&gt;It is debatable whether it is right to count it or not, but anyway I decided to take advantage of this, &lt;strong&gt;refreshing the ad each time the URL changed&lt;/strong&gt; (I'll keep the technical side of these changes aside, but if someone is interested just ask me), That's it, that's was the small change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F90o2a4gpqilfz4pho4td.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F90o2a4gpqilfz4pho4td.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Ad refreshing each time a filter is applied.
&lt;/h6&gt;

&lt;p&gt;As you can see, it is a non-intrusive way to show more ads to the users but in a nicer way, not just throwing annoying ads all over the page.&lt;/p&gt;

&lt;p&gt;I believe this kind of change could be useful for a lot of people that have a website like curated lists, job boards, etc, any page where the people spend a lot of time playing around with filters or something similar.&lt;/p&gt;

&lt;p&gt;Well, that's it, thanks for reading, I hope it was useful.&lt;/p&gt;

&lt;p&gt;If you have some suggestions or ideas you can reach me out on &lt;a href="https://www.twitter.com/ngranja19/" rel="noopener noreferrer"&gt;twitter&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to migrate a VueJs project to NuxtJs in 8 steps.</title>
      <dc:creator>Nicolas Granja</dc:creator>
      <pubDate>Wed, 13 May 2020 13:41:03 +0000</pubDate>
      <link>https://dev.to/ngranja19/how-to-migrate-a-vuejs-project-to-nuxtjs-in-8-steps-41dm</link>
      <guid>https://dev.to/ngranja19/how-to-migrate-a-vuejs-project-to-nuxtjs-in-8-steps-41dm</guid>
      <description>&lt;p&gt;A couple of months ago I built a project using my favorite stack: VueJs + Buefy for the Front-End and NodeJs + Express for the Back-End. Some days later the website started to gain some traction, and I got a lot of traffic, but as most of you might know, a VueJs SPA is not a good option for SEO, therefore I decided to rebuild it completely with NuxtJS.&lt;/p&gt;

&lt;p&gt;Since searching on the web I was not able to find any documentation or tutorial of how to do it, &lt;strong&gt;I’ll try to explain step by step what I did. I tell you in advance that it is very easy and just takes a couple of hours, but I’m assuming you have some idea of how nuxt works&lt;/strong&gt; (if is not your case, I highly recommend you to read the &lt;a href="https://nuxtjs.org/" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create the nuxt project
&lt;/h3&gt;

&lt;p&gt;First of all, create the nuxt project using &lt;code&gt;create-nuxt-app&lt;/code&gt; . You can get more information  &lt;a href="https://nuxtjs.org/guide/installation#using-code-create-nuxt-app-code-" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Copy your Stores
&lt;/h3&gt;

&lt;p&gt;If you aren’t using Vuex in your VueJs project you can skip this step. If so, you can pretty much copy your store files to the new &lt;code&gt;/store&lt;/code&gt; folder in your nuxt project. In my case, I was just using an index.js file. In case you had split your store in modules you can follow &lt;a href="https://nuxtjs.org/guide/vuex-store" rel="noopener noreferrer"&gt;these instructions&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Copy your Components
&lt;/h3&gt;

&lt;p&gt;First, we have to differentiate what is a component and what is a page. I don’t know which directory structure are you using, but I usually split my .vue files into two folders: &lt;code&gt;/views&lt;/code&gt; and &lt;code&gt;/components&lt;/code&gt;. It is pretty obvious, but in the views folder, I put those vue components (.vue files) that are pages, i.e: About, Home, FAQ, etc. While in the components I put those subcomponents that I reuse - and are included - in the views.&lt;/p&gt;

&lt;p&gt;In case you are not following a structure similar to this one, you’ll have to make this distinction, and just copy the components - that are not pages - to the corresponding new &lt;code&gt;/components&lt;/code&gt; folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Create your Pages
&lt;/h3&gt;

&lt;p&gt;This time, you should rethink your pages and recreate each route following the convention specified by Nuxt.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Nuxt.js automatically generates the &lt;a href="https://github.com/vuejs/vue-router" rel="noopener noreferrer"&gt;vue-router&lt;/a&gt; configuration based on your file tree of Vue files inside the &lt;code&gt;pages&lt;/code&gt; directory.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you don’t have any idea fo how to do this, I recommend you to read the following sections of the official Nuxt documentation: &lt;a href="https://nuxtjs.org/guide/routing" rel="noopener noreferrer"&gt;Routing&lt;/a&gt; and &lt;a href="https://nuxtjs.org/guide/views" rel="noopener noreferrer"&gt;Views&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Change router-link for nuxt-link
&lt;/h3&gt;

&lt;p&gt;Once you have all your components and pages in the correct place, you will need to change all your router-link for nuxt-link. To see how nuxt is naming the routes you can check the automatically generated file inside &lt;code&gt;/.nuxt/router.js&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Change the way you fetch the data from your servers
&lt;/h3&gt;

&lt;p&gt;You should go through all your new Pages, and refactor the way you were loading the data from your server.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You may want to fetch data and render it on the server-side. Nuxt.js adds an &lt;code&gt;asyncData&lt;/code&gt; method to let you handle async operations before initializing the component&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;More information about &lt;code&gt;asyncData&lt;/code&gt; &lt;a href="https://nuxtjs.org/guide/async-data" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you were also fetching data in your components and you are trying to use &lt;code&gt;asyncData&lt;/code&gt;, this is won’t work, because components don’t have an &lt;code&gt;asyncData&lt;/code&gt; method. &lt;/p&gt;

&lt;p&gt;But don’t worry, there are two solutions to this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make the API call in the &lt;code&gt;mounted&lt;/code&gt; hook. Take in count that with this way the server-side rendering won’t work&lt;/li&gt;
&lt;li&gt;Make the API call in the &lt;code&gt;asyncData&lt;/code&gt; or &lt;code&gt;fetch&lt;/code&gt; methods of the page component and pass the data as props to the sub-components.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  7. Add your plugins
&lt;/h3&gt;

&lt;p&gt;Go to your main.js file of your VueJs Project, and identify which plugins you are using. Then set up all your plugins following the instructions &lt;a href="https://nuxtjs.org/guide/plugins#vue-plugins" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Add the external resources
&lt;/h3&gt;

&lt;p&gt;Finally, If you are using some external resources in the index.html file of your VueJs project, like stylesheets or an external js script, you can include them in the head object of &lt;code&gt;nuxt.config.js&lt;/code&gt;. See more info &lt;a href="https://nuxtjs.org/faq#global-settings" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;After doing all those changes, you can see how it looks like my new NuxtJs project compared to the old VueJs (pretty similar right?).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fat7lnjsjonk7bnuli9ue.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fat7lnjsjonk7bnuli9ue.png" alt="Directory Structure of both projects"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are wondering which was the project that I rebuilt with NuxtJs you can see it here: &lt;a href="https://knowyourworth.app" rel="noopener noreferrer"&gt;KnowYourWorth&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know if you have any question or reach me out on twitter &lt;a href="https://twitter.com/ngranja19" rel="noopener noreferrer"&gt;@ngranja19&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;

</description>
      <category>vue</category>
      <category>nuxt</category>
      <category>ssr</category>
      <category>seo</category>
    </item>
  </channel>
</rss>
