Blog

Google Tag Manager

GDPR Compliance for Google Tag Manager and Google Analytics

The time is upon us when we all have to comply with the EU’s regulations on privacy. While websites in the USA don’t have to technically comply BUT everyone accessing your site from the EU is protected under this statute and so it is best for all of us to “get with the ball game”, so to speak.

So what are we supposed to do? Let me list down the steps that need to be taken.

Step 1: Data storage in Google Analytics. Please go into the Property Setting and look for the Data Retention menu as below:

gdpr_ga_01
Make Data Retention as long as possible

Click on the tab and you will see choices of how many months of data to keep. I went for 50 months because that is the maximum time explicitly allowed. I wouldn’t recommend “Do not automatically expire” option because it is quite vague.

The option “26 months” is a Google-suggested default, just so you know. Here is some more information on Retention.

Step 2: Anonymize IP. If you use Google Tag Manager as any normal human being should, this is a very simple setting change. Please go into the Universal Analytics tag that fires on every page view and set the Fields to Set to have anonymizeip as TRUE.

gdpr_ga_02

Now, the last 4 digits of a user’s IP will be marked as ‘0000’ and you cannot identify them in any way. Not that you were doing anything with it but still, that is the guideline.

If you are not able to use GTM for any reason, just change the normative collection by adding the following to every page of your site.

<!– Global site tag (gtag.js) – Google Analytics –>
https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID

Step 3: Advertising and Re-targeting. Some of the more conservative folks are recommending that you shut down the re-targeting and advertising features in Google Analytics. If you are not using them, do turn them off, otherwise there is no harm in keeping them on.

gdpr_ga_03

Step 4: Set up a cookie consent form. The best recipe that I have seen is by our friends at AnalyticsMania. This is a great a quick recipe to install using Google Tag Manager. It will put you in more compliance than is absolutely necessary.

One more thing…..

Step 5: Audit your site so that there is no PII being sent to Google Analytics. So any emails, userID’s or any unencrypted content. I know a lot of folks who have email addresses floating around in URL’s or events.

Please desist!

You do not want to be banned from Google. Getting back in requires and lot of work. Clean all new data collection to make sure nothing personal gets recorded in Google Analytics. Read this article; memorize if necessary.

You are all done and now can rest easy that the EU will not come after you.

Uncategorized

UserID tracking in Google Tag Manager(GTM)

uid_gtm

Why do we need to do that?

Ostensibly Google says that you do this for tracking true users of your site. Since multiple devices generate a visitor cookie each, they get counted as different visitors. You can stitch sessions cross-device by creating a userid view.

However, if we want to track CAC and LTV by referral sources and we have only Google Analytics and an internal database around, we can piggyback on this method to measure them.

It is tricky and will require some testing before it runs in your environment. However, it works and I have managed to figure it out in Google Tag Manager and will lay it out for you dear analyst, step by step.


Step 1

Create the User-ID view in Google Analytics. Go to the Property and expand “.js tracking Info”. Then follow the prompts as seen in the picture below.

uid_gtm_02

After you have done the above, let’s create a dimension to store this data.

Step 2

In the same property column, below the PRODUCT LINKING tab, sits a place to create custom dimensions as shown in this picture below.

uid_gtm_03

Click on create dimension and add the custom dimension as shown below:

uid_gtm_04

Please note that you have to name it userID. This is because I am going to name the data layer variable later the same. They have to be so to capture your user information.

Step 3

Have your awesome developer pass the user-id value to the data layer variable called userID. The values that it should spit out if you click “view-source” on your site should look like this:

dataLayer = [{‘userID’: ‘yyyyyy’}];

dataLayer.push( {‘event’:’uidAvailable’, ‘uid’:’yyyyyy’} );

They can push this change live anytime and will be quite thankful for the Starbucks drink you will treat them to.

Make very sure that this userID being made cannot be Personally identifiable information(PII). So no names, email addresses, etc.

Step 4

Ok! Let’s push on now to the Google Tag Manager and the last part of this implementation.

Open up your tag manager and on the left hand side where it says, variables, click and add a user defined variable. We will call it userID.

uid_gtm_05

Now, on the left hand side open up the tags section. On all the tags that have anything to do with an event or page view, we will make slight edits. Let’s start with the Google Analytics tag (it should be set to universal Analytics otherwise this will not work).

uid_gtm_06

We add two variable to be filled when the tag fires, one is the userId (please note that this is the exact name you need to set). The other is the custom dimension that we have created in Google Analytics so we can run reports based on our own user-ids, which I am sure, are aligned to email addresses.


Step 5

Now, let’s set our workspace on Google Tag Manager to Preview the changes that we have made. If this works, the Real-Time reports in Google Analytics will immediately start collecting data. Once it works, then go ahead and publish the new tags.

Now, you should be free to download the userID and referral source. You can download the LTV and userID from your own database and analyze in Excel or any other spreadsheet of your choice.

You would have noticed that I keep harping on the name and case of the variable “userID” and “userId”. I thought to name all variables the same and it didn’t work. However, hard-coding the variables works perfectly!

Do let me know if you have any issues with this and I can walk you through the implementation, if need be.

Analytics, Google Tag Manager

Tracking Google Analytics Events in Squarespace

GA_SS

In the world of freelancers one does come up against massive walls of code that are really not made to work with one another. In setting up Google Analytics tracking on any site that is made in wordpress, Wix or Squarespace, one encounters all sorts of peculiarities.

I am going to talk of capturing events in Google Analytics from within the Squarespace environment.

First of all, the normal way to integrate Google Analytics in Squarespace is easy enough. Just do the following:

Config  — >  Settings  –> Advanced  –> External Services

and put the UA-XXXXXXX-Y number in there.

However, please note that this will conform to Google Analytics tracking that is several generations old.

This is just page view tracking though.


How does one add event tracking where a new page is not going to be called?


I am going to describe how you do this for a newsletter capture lightbox in Squarespace.


It turns out that there are three ways to do this although only one works for me. I am listing all three in case my environment is weird and the other ways might work for you.


1. Use Javascript shenanigans:

Essentially, what you want is to pass the event code to Google Analytics only when the submit button on the lightbox is clicked. For that you set up a listener to call a function which fires the event tracking code when called. This is very well described by Rocketeer SEO Hero and also by Silvabokis.

This did not work for me. Even though I tried several combinations but the variable value that should get assigned to 1, never happened.

2. Try and force Google Tag Manager(GTM) to do this for you:

GTM is not supported directly in Squarespace. You have to take your GTM header code below:

<!– Google Tag Manager –>

(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:

new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],

j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=

https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);

})(window,document,’script’,’dataLayer’,’GTM-XXXXXX’);

<!– End Google Tag Manager –>

and put this on Config  — >  Settings  –> Advanced  –> Injection (Header)

Then take the code that should reside in the body tag

<!– Google Tag Manager (noscript) –>

<noscript>https://www.googletagmanager.com/ns.html?id=GTM-MN8VFPH</noscript>

<!– End Google Tag Manager (noscript) –>

and put it here  Config  — >  Settings  –> Advanced  –> Injection (Footer)

This is also described well by Yoweb.

Now go to Google Tag Manager and build an event only tag that collects data when a trigger is fired upon a particular form class is seen. Please see this wonderful description ( read carefully for this process is convoluted) by Atomic Marketing.



3. Try to play within Squarespace:

This is a simple technique and did work for me. Go to the newsletter form and click on edit.

form_edit_GA_SS

Click on Advanced and then scroll down to ” Post-Submit HTML”.

Now, this is a place where you put in the event call as follows:

   ga(‘send’, ‘event’, ‘newsletter’, ‘click’, ‘submit’);

 

Effectively, you are stating the Event Category [newsletter], Event Action [click] and Event Label [submit].

Go into the Google Analytics interface and add these values as a desirable goal and you are done. This method is quite simple but please be aware that this may not work like this if Google stops supporting this or Squarespace updates their codebase.

In any event, I hope this article is of some use. Do let me know if you have any further questions.

Analytics, Freelancing

The virtues and challenges of Freelancing

The days go by and you are sitting at your desk at home waiting….

…waiting for someone to respond. That great job post you saw yesterday was just so tailor-made for you. They have to call you! They would be stupid not to.

…and you wait some more. You watch TV in frustration thinking of how you are just wasting your life away for calls that never come; messages that go unanswered; and proposal that go unseen.

The perils of freelancing are many. Waiting for someone to give you a first break is one. In my early months, I always thought that I was doing something wrong, hence the lack of jobs. Slowly, I realized that while I did make mistakes, the nature of the business is such that it will take you years to get settled. Particularly, if you don’t have actionable coding skills. So waiting is a significant part of the job.

The other problem that most of us who are not salespeople encounter is the amount of rejection that is the norm. When working for a company, your work is not rejected everyday. There is an automatic buy-in from your employer on whatever you do within certain parameters like performance reviews. While freelancing, one is rejected constantly. Over time time, I have learnt to expect 90% rejection, at least. Once you do that, it becomes the new norm and you don’t lose too much sleep over it.

A third major issue I encountered was the constant selling of yourself or your skills. One doesn’t have to do this in a regular job. It is taken as read by your colleagues that your skills are of some value. One could argue that you make a better case for advancement in an organization if you sell your ideas better than others. However, in freelancing it is all about the sales pitch. You have to hone several pitches for different kinds of jobs and be unremitting in your proposal follow-ups. No one looks at your resume and very few actually read your profile. Almost all of my jobs are a result of personal conversation via Skype or the phone. Conversations that were all about selling myself!

The great joys of working on your own time are many too. I have gone through a very bad health phase ( a bit of jujitsu with cancer) and this allowed me to work whenever I was able to. The flexibility that a freelancer has is probably the most important selling point to this style of work. There is true joy in working at your own convenience. Be disciplined and keep weekly to-do lists. You are your own boss and employee too.

Working on various different projects and problems also forces you to keep on top of new technologies and better ways of doing work. Continuing education is another great asset of freelancing. I have learnt more about coding in the last six months than I did in the last three years. There is no administration overhead and that generates enormous amounts of free time for one to learn. I usually look to UdemyCoursera and the O’Rielly Bookshelf to help stay in touch with all the goings on out there. Youtube is a serious source of learning too.

Another thing that relates to one’s usage of time is the opportunity to just get up and go somewhere during the day. The time of rest between jobs and within them cannot be had in any other lifestyle. I have found time to go to the museums, drive around for fun and volunteer for various non-profit organizations. I have found a lot more time to cultivate relationships and talk to my family: the important stuff of living, really.

It’s a good life but in the beginning, like every business, it is a hard life. You just need to remember not to let the waiting, rejection and relentless sales pitches get to you. Also, make sure that you continue to bid or reach out for jobs all the time. Don’t sit back. A freelancer, ironically, cannot afford to be too relaxed.

Still interested in going down this garden path…

Then the best places that you can freelance in my opinion are, UpworkToptal web developers Community and Freelancer. You can also find some freelance work on Linkedin if you build relationships there.

Let me know if you have any questions.  I will be happy to help.

Google Tag Manager

Gravity Form Tracking with Google Tag Manager

Objective: Record all gravity form Interactions

Process:

There is no good way of linking Gravity Forms and GTM that is documented by either party.

I found a method devised by another power user that uses form submissions and started to follow that.

However, form tracking in the way he put it together does not work for us.

I suspect that is because multi-page gravity forms don’t have a submission until at the very end.

So, I devised a way that piggybacks on the tag generated when a Gravity Form(GF) is fired.

This tag is generated by placing a custom javascript event.

You can copy the contents below and it should work for you if you use jQuery[help link]

————————————————————————————————————————–

if(jQuery(‘.gform_confirmation_message’).is(“:visible”))/* page load */ { var formId=jQuery(‘.gform_confirmation_message’).attr(‘id’).replace(‘gform_confirmation_message_’,”); dataLayer.push({‘event’:’gform.submit.success’,’formId’:formId}); } jQuery(document).on(‘submit’,’form[id*=”gform_”]’,function(){/* for Ajax Load */ clearInterval(window.gsetInt); var formId=jQuery(this).attr(‘id’).replace(‘gform_’,”); jQuery(this).find(‘.gfield’).removeClass(‘gfield gfield_error ‘) window.gsetInt=setInterval(function(){ if(jQuery(‘.gform_confirmation_message_’+formId+’.gforms_confirmation_message,.gform_confirmation_message_’+formId+’.gform_confirmation_message’).is(“:visible”)) { clearInterval(window.gsetInt); dataLayer.push({‘event’:’gform.submit.success’,’formId’:formId}); } if(jQuery(‘#gform_fields_’+formId+’ .gfield_error’).is(“:visible”)) { clearInterval(window.gsetInt); dataLayer.push({‘event’:’gform.submit.error’,’formId’:formId}); } },200); });

————————————————————————————————————————–

Once you create the event, turn on the preview mode in GTM and see if the GFTrackEvent is firing.

This event works has the following content:

  1. That tag(“Gravity from custom tracking”) fires and creates an event called “GFTrackEvent”

gf_1

2. I created a trigger,”Find GFTrackEvent”, that fires after the above event fires

gf_2

3. I created a dataLayer variables to capture the label from “GFTrackEvent”. If needed,

you can also capture the action but we don’t need it right now.

GFTrackLabel

gf_3

4. I created another tag called  “Event Tracking Tag For Gravity Form” which stores the above dataLayer values

gf_4
This tag get fired when either “GFTrackEvent” occurs OR when we get to the lead thank you page.

5. The picture below shows them as events being recorded in Google Analytics.

gf_5

Result: The tracking of submission works and also includes the pages that were being paginated to.

Usage: We can use this pagination and lead capture in the dashboard stating now

Improvements Possible: If we want to track the exact options that a user chose on each of the

pages( apart from personal information which Google does not allow), then will have to pick up

information from click elements and somehow fire that as events.

Please let me know if you have any questions.

Analytics

Learning from Twitter

Three quick learning points from Twitter over the last month

  • Always follow back people who follow you.
    • if someone follows you, it is only decent to check out their twitter feed and follow them back if your interests match.
    • Re-tweet their pinned tweet or another prominent tweet that you read and liked. Yes, you need to make that effort. It will enrich your feed too.
    • Check out their followers and follow them too. This is not a contest on who has more followers but more an opportunity for you touch base with thought leaders in your domain.
  • Make sure you put an effort towards providing good content to your followers.
    • Everyday, I am devoting time to my mailing lists and emails to make sure that I can recommend some good reads to my followers.
    • Post images and constantly change the content of your pinned tweet. It garners more attention in Twitter world.
    • Without realizing it, you are running a daily newspaper. You don’t need to get frazzled but 4 to 5 good posts a day will keep your followers engaged.
    • This will show in re-tweets and replies and likes. I get on average 1, 1 and 3 respectively.
  • This is a great channel to build relationships.
    • You will be surprised how many people will write you directly and offer to help. Take them up on the offer and offer your own help. Do not talk money. We all know the difference between favors and paid work.
    • When re-tweeting, please try to mention your own take on the thread or link. It will help other in your list make sense of what is being talked about.

I hear a lot of conversation about monetizing social media channels and earning millions of dollars a month. Well, of course no one minds earning that kind of money. However, like everything else, this is an activity that requires a lot of effort. Take an hour or two a day to do this well.

My amazing experience with Twitter traffic started on Jan 20st, 2017 when my following suddenly rose  from 550 to 650 within a day. I was delighted but puzzled. I still am. My handle @ateeqhmad has been around for 7 years with barely anyone listening and then suddenly a huge jump.

It didn’t stop there either. By Feb 1st, 2017 , my followers were up beyond the 1,000 mark and are still slowly climbing everyday.  I had some great interactions with people; absorbed a lot of good ideas and learnt that this is a wonderful tool to interact with others.

There are several good Social Media tools out there. Use them if you have $20 a month to spare. However, I would advise against too much automation. It takes away from the spontaneity of life.

Most importantly, have fun!

Uncategorized

The education of an Analyst

There are really two streams that we can see these days coming out of Master’s programs. One is the marketing/product Analytics practitioner and the other is data science practitioner. At the initial levels we need to learn  both streams because it will not really be clear to a student where their capability or interests truly lie.

Based on this premise, I would like to suggest a few types of learning that web analyst in particular need to imbibe in the start of their careers.

Business Writing is factual journalism.

I have experienced a lot of analysts coming in with lots of capability with numbers but none with writing business stories. I also see many analysts who don’t know the first thing about how to use stats tests in real life situations. Simple questions like —  Did the pricing change lead to more leads? Are the results statistically significant? — make us all go into huddles and battle stations.

Several online course providers offer creative writingbusiness writing or journal writing courses and I think they should be part of any Analysts formative education.

Knowledge of the tools.

We need to provide hands-on understanding of the tools that are used in typical business analytics. I have seen a lot of spreadsheets(Excel wizardry can take you lots of places) being used.

There are some statistical packages like R(open sources and free, hence very useful), SPSS and SAS that the analyst should be familiar with. More importantly, they need to be able to live and breathe statistics because the core fundamentals are always useful. Some elements of data mining and clustering should also be learnt as needed or as a person’s curiosity demands it.

These days, data visualization done correctly, explains half the analysis by itself. So, some experience in TableauMicrostrategyQlikview is very important in explaining the information clearly.

I also see a lot of visualization available via Google Data Studio and Power BI.

At the end, it is all code.

Whatever the environment of development in an organization, the analyst should have a fair idea about it since all the measurement hooks are mostly encoded. Even the ubiquitous Google Analytics is run based on javascript. A solid grounding in Python, PHP and SQL is also important so we need some intermediate technical courses to get a well-rounded technical perspective.

Understand the data river as it flows downstream

Although, large amounts of data exists, we don’t get training in information architecture.. How do you get unstructured data to structured data, to BI tools and to reports and metrics is something that needs to be taught too. The analyst can use some BI tools and data warehouse development and maintenance skills. As it become more common to build self-service reporting systems, we need to be able to teach some rudiments of this skill to our budding analysts.

Project Management

Most Analysts end up in large project teams as core members in-charge of numbers. So we need to teach them principles of project management and the current techniques like Agile and kanban. This will help them build their managerial skills too.

Design and Analytics

A good analyst will have a strong creative streak, not just have a good head for numbers. We need to be able to look the system that we are trying to improve (or make profitable) from a design perspective too.

In fact, a lot of web analytics is done just to measure and influence the design and flow of the information on the site for the customer. Conversely, not many designers are just going to rely on their intuition while building a site. They would ask the analyst about measuring the success of a particular design. So, a couple of introductory courses on creative design are essential for the education of an analyst.

I hope these make sense dear reader. Please let me know your thoughts.