Sunday, May 10, 2015

Google Tag Manager with ASP.NET MVC – Tracking Page views

 

Google tag manager makes life so easier for use Google analytic. Because of GTM, marketers can handle the Google analytics without the help of web developer. In this post describe how to use Google tag manager with ASP.NET MVC to track page views of a web application. Setting up the GTM is simple and needs to create the container and put that JavaScript code in your base HTML page. When you use GTM, you have to deal with tags, rules and macros. Every tag must contain a rule to fire. Rule require a certain condition to trigger.

Let's go down with following steps to setup GTM with MVC applications.

1. Login into the Google tag manager and create the container. Enter account name and container name as below.

1

2

2. After create GTM container looks like as in below image. Container id shown with red color boxes.

3

3. Go to your “_Layout.cshtml” page of the MVC application. Copy and paste container content as shown in below, just right after opening tag of “<body>”. In this image shows red color box highlighting the GTM container id. This is a unique id and GTM and application use this id for communication.

4

4. Now you have to publish your application. I used my azure account to publish the application. After you successfully publish you will get your application URL. Using that URL sign up with Google analytic account. After successfully setup the analytic account, you can get your tracking id for the web application. Use the tracking ID to create GTM tags.

6

5. Create a tag as shown in below using analytic tracking ID. Select Tag type as “Universal Analytics” and track type as “Page View”

7

6. Add a rule for this tag as below. this rule will execute when relevant tag fire.

8

7. After all above steps publish your GTM. After you can see the results in your Google analytics dashboard.

Sunday, May 3, 2015

Code snippet plugin for Live Writer on Blogger


I started to use windows live writer as my blogging tool. When I'm starting to use it, I had to face one problem which was how I'm going to publish the articles with code snippets. I’m using Blogger as my blog engine. So plugin I'm looking for must work with blogger too. After few search in the Google, I found few plugins to use code snippets with blog articles. One thing I noticed from all of those tools was none of them not updated very recently. In the end, I selected one tool to use with my live writer for blogging. You can check it from the below link.

https://sourcecodeplugin.codeplex.com/

This tool uses SyntaxHighlighter version 3. That was one of the main reason to select this tool. Because most of other tools not updated with SyntaxHighlighter version 3. When you are going to use this plugin for the first time with the live writer it pops up an error message saying “Can't load configuration from 'C:\Users\username\AppData\Roaming\Windows Live Writer\WindowsLiveWriter.SourceCode.config file”. What you have to do is ignore that error and move forward. And it won't appear in the after the first time. This is something known issue and writer of this plugin discuss this in the discussion section in CodePlex site.

Earlier when I want to put code snippet to the blog post I had to keep the code with SyntaxHighlighter tags. Now I don’t need to worry about that. this new plugin does it for me. Now blogging become easier than previous.

Saturday, May 2, 2015

Windows live writer on Blogger

 

After a long time back I tried to use windows live writer as my blogging tool. I used it early days and suddenly I missed it. So after I install windows live writer 2012 (latest version) I tried connect with my blog. My blog engine is a blogger. I entered correct URL, username and password. I checked that with the browser as well to verify details are correct or not. I tried 2 or 3 times but no luck. I search in the Google and I couldn’t find the good solution for this matter. because of that I thought to write about this then this might be helpful to someone else. The below image shows the error message.

dd

After all the attempts, I found the solution. In my Google account, I activated the 2-way verification system to my Google account for unknown applications and devices. When I'm logging through unknown device’s browser I get the security code and I enter it can use the particular Google service.  But with live writer there is no any method to use it that way. Because of that I need to go to below link and add live writer. Then I get generated password by Google. I have to use it for the sign in with live writer and blogger.

https://security.google.com/settings/security/apppasswords

After complete above steps, I logged in successfully with my live writer and the blogger. So here after all blog post will come through the live writer.

Happy blogging. Ohhh yeahh Winking smile