Friday, June 6, 2014

Google Tag Manager: Custom Javascript Macro - A Useful Example

Making a Custom JavaScript macro in Google Tag Manager is a very effective way to get some tricky little tasks done. 

Sometimes you may need to parse something out of a longer string, and then put that sub-string into a Custom Dimension, or use as a macro in other Tags. The way to do this is to create a Custom JavaScript macro.

In the example below, I'll take you through the step by step process for creating a Custom Dimension to hold the domain or sub-domain name for any page. In this example, I'm extracting it from the "hostname url" via another macro. 

Required: Universal Analytics, and GTM.


  • Start by creating a Custom JavaScript Macro. 
  • From the NEW button, select "Macro". 
  • Macro Type: select "Custom JavaScript". 



  • A JavaScript function needs to be created to parse the element you're interested in. 
  • In this case, I'm referencing another macro called "{{url hostname}}", which as you've surmised, it holds the value of the hostname url for the current page being viewed on your website.
  • Components of the JS:
    • Fist, store the "url hostname" into a var called 'suddom'
    • parse the var three times (easier to break into steps than nest)
      • var subdom = hosturl.split('.')
        • This uses the '.split' function to extract each piece of a string by using the '.' as a separator between words, and then stuffs each word into a separate index in the array you provided (in this case, 'subdom'). 
        • e.g. If the url hostname was 'jello.coolfoods.com', then after the .split command ran, 'subdom' looks like:
        • subdom[0] == "jello"
        • subdom[1] == "coolfoods"
        • subdom[2] == "com"
      • Whew: all we're interested in is the first word, "jello". That's what we'll be returning at the end of the function
      • In the case above, I'm doing an extra step because I'm removing the word "admin" from the subdom[0] element through some other code. You can skp this, or include it in case you have a bit of the subdomain / domain that you want to strip off. In that case, replace "admin" below with your unwanted string bits.
        • var adminidx = subdom[0].indexOf("admin");
        • The index number 'adminidx' is the position of the word admin within the first array element
      • Now return only the first part of the 'subdom' as desired by the adminidx above.
    • Return subdom[0].substring(0,adminidx); 
      • This returns only the first piece of the subdomain by using the substring feature to extract the string between each of the two array indices [0] and ['adminidx] value
    • Cool. The function is done
    • SAVE

  • The url subDomain macro is dependent upon the url hostname macro that extracts the hostname from the DOM
    • Create a macro of type "URL"
    • Set component type to "Host Name"
    • Check the check-box for "Strip WWW"
    • SAVE














  • Next, go into Admin in GA, and create a Custom Dimension in your web Property under. "Custom Definitions --> Custom Dimensions".
    • In our example, it's named "{{url subDomain}}"

  • Now that we have a Custom Javascript Macro called 'url subDomain', we need to use it to create a Custom Dimension in your Page View tag -- a firing rule must trigger this for ALL pages


  • Save, Debug, and Publish!. 
  • Connect with me and let me know if you like this one

Wednesday, March 19, 2014

Leaving Money on the Table in Performance Marketing


There's an Analytics opportunity that’s leaving money on the table - Las Vegas style.


I grew up in Brookfield, a small town in Illinois where there was one candy shop. When I was five my Dad walked me there, and the clerk filled up a paper bag with jelly beans. I proudly walked back home, holding that bag with two hands to guard my treasure, and when I got home, there were only a few left in the bag. Some tiny hole let out one jelly bean at a time as we walked. Being five, it was the end of all good things.


There’s an unspoken huge money drain that happens when marketing campaigns aren’t visible to analytics, and nobody talks about it. It’s embarrassing, it’s messy, and it’s one of the simplest money making fixes for a business. It all has to do with keeping your jelly beans once you bought them.


In this case, the jelly beans represent performance marketing, and the bag with the hole is cruddy campaign URL tagging.


Paid traffic is a huge investment. Here are three ways that businesses consistently lose big money, and where their analytics are completely wrong.


  1. Campaign URLs are not tagged at all
  2. Tagging standards are not enforced, inconsistent, or wrong
  3. Traffic partners mess up your campaign tags


What are campaign URL’s and Tagging?


Campaign URLs are the links that lead people who click on the paid internet ads you bought on Google, Bing, or other places,  or the social media links you included in a Tweet or Facebook post. A user clicks on one of these, and they go to your site.


There are things you put on those Campaign URLs called “parameters” which tell your analytics system how to understand that this bit of traffic is purposeful, such as being a visit from your “New Shoes for Valentines” campaign, vs just a generic visitor coming from some unknown wherever.


Campaign URL tags are the sets of parameters all taken together, and put onto the end of your URL, which is then provided to the paid traffic partner (e.g. Google), or shoved your Tweet. This whole URL is called a Landing Page URL, or Landing Page.


When Campaign URL tagging is correct, life is awesome. Your analytics data tells you wonderful things about the mega amounts of people coming from your Google ad and want to buy “Shoes for Valentines”.


When tagging is cruddy, life sucks and your analytics tells you half or less of the story or virtually none. Bad tagging is kindly referred to as an Attribution Problem.


Don't’ have bad tagging, lose your jelly beans and have an Attribution problem.


Some companies I've worked with (no names) pay in excess of $200 million / year on paid marketing, and call it Performance Marketing. When your analytics can’t track the keyword you bought then it’s pretty tough to know if making money. On average, I've seen this problem affect up to 10% of a company’s traffic when they think they are tagging successfully = a $40 mil/yr problem. Even in Vegas, that buys you High Roller status, except in this case, you’re losing.


Performance marketing is supposed to refer to good performance.


You’re leaving money on the table when there isn't good Campaign URL tagging, and in my experience, it usually goes undetected for months and that’s completely fixable.


For all the money spent with Google, Bing, Adconion, or whatever company where we buy marketing traffic, none of them care how you tag your URLs. It’s all good as long as we pay them. If you use a cool ad management platform like DoubleClick for Search or Kenshoo, you have a great platform to track your stuff. But, once again, nobody is at home and watching your house. Ad platforms and ad or bidding management software doesn't do anything to take care of ALL of your Campaign URLs, especially for traffic not bought from Google or Bing.


There is nobody watching: no one cares about your URLs except you. Why? Because it’s your problem.


4 Ways to Fix the jelly bean bag:


  1. Create a set of Campaign URL tagging best practices and stick to it.


Google Analytics and Site Catalyst have tagging standards for URL parameters.  Your company may use both, so create a matrix in Excel to standardize what goes where and for what partner. That sounds kinky, but it isn't.


  1. Assign someone as the owner of your tagging scheme.


This person is the Czar with absolute authority to tell anyone they’re tagging is kaput, whether for a single silly Tweet,or for the owner of the $500 million dollar performance marketing budget. This person also debugs problems with tagging, and makes sure new marketing people and campaigns do tagging according to plan.


  1. Assign another someone to work with traffic partners, and get them to “fix it”


Traffic partners like Google and Bing don’t listen to this noise because they aren't causing the problems. The smaller companies are the culprits. MANY times I've seen them just refuse to do the tagging that I've laid down. That’s just not good poker... for them. Assign someone (maybe the Campaign Czar above) to remind these partners that you’re paying them for a service, and to please do what you told them to do. They usually will. Many times, it’s just a set of honest mistakes, or bad coding that they’ll gladly fix. They want to make money too.


  1. Build or Buy a Campaign Management system that does your tracking for you.


Super important. Since there are over a hundred paid traffic partners out there in the US alone not counting dynamic duo of Google and Bing, there are a super huge amount of potential campaign URL tags. It’s a lot of debugging to do for hundreds of thousands of URLs and can make people lose their minds. Look for a Campaign Management solution that will allow you to create and store your URLs for ANY traffic partner, error check them, and store your stuff historically, as well as upload them to your hundred partners. There is only one I know of, and it’s under development by experienced people who worked their way through and conquered this big money drain problem.

* Watch for an update from me on a new solution for this problem in coming weeks.


Don’t drop your jelly beans on the ground; get a better bag.


This stuff is difficult only because it’s very exacting, but it’s not very technical. Think of it like running a tiny library, but each book makes you money if it gets returned. Don’t leave money on the poker table. Vegas always makes money, and Analytics was invented there by Ballys.

Tuesday, December 3, 2013

Secrets to Remarketing with Google Analytics Lists

Wednesday, September 25, 2013

Secrets to Google Organic Keyword End


Google finally closed the door on the ability to track ANY organic keyword searches coming from Google. 

See article link here: http://searchenginewatch.com/article/2296351/Goodbye-Keyword-Data-Google-Moves-Entirely-to-Secure-Search

Google has transitioned to HTTPS instead of HTTP which means it’s using secure protocol to send traffic from any “free” organic search terms to a site.

What Happened: 
This was a process that started late in 2011, when Google removed about 20 – 30% of the inbound organic keyword visibility from any analytics source. It was speculative that they would take away the rest, but it’s been completed as of today’s announcement. Google has moved to a Paid-only model regarding search traffic visibility by incorporating organic search impression data into AdWords, and eliminating it from external tools (analytics). Article here. http://adwords.blogspot.com/2013/08/analyze-and-optimize-your-search.html

Impact: Optimizing organic (SEO) terms becomes more complicated, but doable. Google organic keyword will now show up as “(not provided)” in all analytics products – including Google Analytics. Google organic keywords are hidden, but Bing isn’t – and neither is Yahoo, Ask, or other smaller search engines. Google Analytics, and the Ginzametrics tool, as well as Comscore, and others will no longer show Organic keywords with high accuracy.

Work arounds: SEO (organic inbound search) keyword/competitive optimization, and SEM paid to free optimization will need to rely more heavily upon Bing, and other search engine sources in Analytics, rather than Google. We can report on traffic sources that are NOT Google for organic (free) search traffic. Even better,  AdWords reporting now includes Google Organic keywords. This means we still have visibility, but ONLY inside of AdWords.

What is not impacted: Any Paid search. It’s immune: if it follows our tagging rules. If tagging has not be properly implemented based upon the standards I’ve created, then it’s going to be hidden from Analytics, and other tools that attempt to decipher it. In Google Analytics, or any analytics, we can still see the amount of organic keywords coming in, but no longer any of their keyword names – we can do a count of (not provided) from Google/Organic source. This at least gives us a gross number for Organic metrics, but not specific organic keyword performance. As stated, AdWords Organic keyword reporting will provide our needs.

What to expect: Bing, and other search engines may provide some commentary, or even other product offerings to try to take advantage of the small window of opportunity this provides in the organic market to rebrand and gain market share in Paid traffic. Long term: seems like at least a small opening for other search engines.

Wednesday, June 26, 2013

Hiring: Do You Like People?



Do You Like People? 

Kind of hard to hire the right ones if you're natural tendency is to avoid them. If you feel your true intentions are misunderstood, and you really don't enjoy the intricacies of human relationships then do yourself and your organization a huge managerial favor:

Hire someone who likes and understands people, to hire other people. 

We're not good at everything. It's great to know what you're good at, and what you're not. If you need help with this, I suggest the Meyers/Briggs test. It's very accurate, and quite awesome. 

Do you have an ex?  Hard to talk with your mother/brother/father/sister (fill in blank)? Ever have a bad interview and still got the job?

This is because you're human. We don't do everything well, and neither do the people around you. Some things we do amazingly well. Stephen Hawking is maybe our most brilliant Astrophysics brain ever. Probably doesn't know all of the band Tool's lyrics...  Don't ask him.

Everyone's different. It's hard to remember when someone is in front of you, but these differences are one of the many things that make interviewing others for jobs rewarding, and challenging.

Does this hiring scenario sound familiar?

1. interviewed a candidate on the telephone, in person, evaluated on a team, shaped offer, delivered, hired.
2. during interview process asked candidate about skills, they described challenges, they solved puzzles, they told stories, they showed charm, they left you feeling pretty good and resolved.
3. hire person, find out later that they have some character defects that make it really tough to work with them, or they were lying about their actual experience, or they quit suddenly to use your job as a ladder to the next.
4. wasted time. Rinse, repeat... 

Liking vs. Understanding:

Notice above I said to hire someone who 1. likes people, and 2. understands them. These are two different things. 

It's easy to like people, but it's not a prerequisite for understanding them.

wikipedia definitions: 
  • to like (verb): Like can be used to express a feeling of attraction between two people, weaker than love and distinct from it in important ways
  • to understand (verb):  Understanding is a relation between the knower and an object of understanding. Understanding implies abilities and dispositions with respect to an object of knowledge sufficient to support intelligent behavior.
Both liking and understanding people ARE prerequisites for great hiring decisions. 

Liking and Understanding are also prerequisites for a huge and tough to comprehend ability that is incredibly important to successful hiring: Empathy. 

Empathy is the innate ability to possess an understanding of the core motivations of others. It is not the common understanding of the term which sometimes is confused with feeling sorry for someone, or sympathizing -- these are actually counterproductive to true empathy. 

Skipping to Suggestions List: (repeated at end):

1. Find or Hire a Commander Troi: they pay for themselves  with their first recommended hire
2. If you don't like and understand people, don't interview them: delegate to Troi
3. Recognize your personal skill limitations and gifts as a manager or contributor
4. Don't wander outside of your "gifts" when interviewing: stick to a plan
5. Treat your Commander Troi with incredible respect: after all, they know what you're thinking

Going back to an ultra-nerdy Star Trek Next Generation reference, Coamander Troi was the ship's Counselor and Ambassador to creeps like the Farenghi, etc.

Her job was to figure out intentions and remove the ambiguity for the other emotionally limited crew members like Number 1, obviously Data, or the "I'm sealed off, conflicted, and also angry" Worf. They never doubted her, and she was never wrong about her area of expertise.

I'm obviously a geek but why the Star Trek reference? Back to Empathy ...

Empathy is not a judgement, nor is it an attempt to subject another's life time of motivations and experiences through our own filter and our own emotional programming. Empathy means to deeply feel in yourself the true motivations of someone else, and then find words to interpret those into communicable conclusions about their character. 

If you have this ability, you can empathize with a sadistic murderer on death row, but still retain the understanding that they deserve their punishment and have no feelings of loss for them. 

People used to be scared of this type of skill. Seems like psychic abilities on late night TV. Those who don't have it, can't see it or comprehend it. Those who do, can't stop it, can't remove it, and have a tough time feeling understood themselves. Thus the need to have someone else in your organization who does. 

Behavioral Interviewing Requires Empathy:

Behavioral interviewing has become ubiquitous as a means to achieve understanding human behavior through a set of questions. We offer scenarios, observe behavior, and make assessments about a person's propensities, or attitudes, or career trajectory.

Huge problem: most people don't understand human behavior -- not the interviewee, and certainly not the interviewer.

Deeper: Most people suck at properly reading people and their underlying intentions. Don't try if this isn't your gift.

Every Company Needs a Commander Troi.

I've received at least 20 interviewing training sessions over my career from nearly every company I've worked for. It was a deluge at Intel, with re-training every 6 months to a year when you were a Hiring Manager there.

Year after year as the training changed at Intel over my 17 year career there, the content changed, but rarely was there a leap of understanding that eclipsed a primitive reflection of basic human behaviors other than skill differences -- until late in the 2000's. Intel developed it's "Valuing Differences" campaign, which was aimed at creating an understanding of cultural differences between people.

This bled into interviewing, where it was recognized (without the Star Trek talk) that the interview process always needed someone who was a Commander Troi.

If you can find one person who is gifted in this area, who is empathetic in their nature and abilities, then viola: they are your behavioral interviewer. Do whatever it takes to retain them.

Example Interviewing Scenarios: 

Technical interviewer's candidate summary: "The candidate was able to write an elegant C# program in the time I gave them, has the requisite skills, and were polite and answered all of my questions without hesitation. We think similarly and I think we should hire them."

Troi's candidate summary: "The candidate is very self-centered, defensive and not at all the team player that we envisioned. There is a tendency to self loath, which seems to have bled into their other jobs because their pattern is to leave after 1 - 3 years when they're bored or have run out their welcome. They have 13 years of experience, and their only references are their brother, and a teacher from college. Their resume is brief to the point of being terse, serving their purpose of vagary so that we fill in the blanks for them and espouse more skills to them than they possess. This candidate will be a black hole in the development team, and we'll lose all the productivity they created after their first 6 months to a year. Don't hire."

Valuing Troi's Differences:

You may notice that your Troi (the empath in your company) likes peace and quiet and alone time. The world is very  loud for them, because other people's motivations keep interrupting. They remember faces, not names. They can mimic voices, and can probably come up with a story about them on the spot that puts the person their describing in a play or script that was never written. They are creative first, analytical second or last.

You can hone this skill if someone has it, but you can't teach it. It's innate.
This skill is highly valuable, and applicable in every area of business: negotiations, communication, managing, interviewing, business ventures, forecasting.

Give them space.
Call on their expertise. 
Let them know they're valued for their contributions.
Give them equal voice.
Use them everywhere they suggest, and anywhere you want to.
They can exist in any role: engineer, manager, janitor, salesperson. 
You probably already have a few: start looking.

Conclusions and  summary of 5 suggestions for successful behavioral interviewing, successful hiring decisions, and an overall lower stress level in onboarding people:

1. Find or Hire a Commander Troi: they pay for themselves  with their first recommended hire
2. If you don't like and understand people, don't interview them: delegate to Troi
3. Recognize your personal skill limitations and gifts as a manager or contributor
4. Don't wander outside of your "gifts" when interviewing: stick to a plan
5. Treat your Commander Troi with incredible respect: after all, they know what you're thinking

Empathy hires successfully: not sympathy, not likability. 

Thursday, June 13, 2013

Big Data: Key Metrics for Optimizing SEM Contextual Ads

Search engines like Google and Bing don't provide reporting that really shows you what you need to fully optimize ads and make adjustments. 

This is especially true for attributing Revenue to their cost reports.
Google and Bing both have APIs that allow your scripts to grab cost and placement fields.

Placements are the site URLs onto which Google or Bing will post your Contextual buys to in order to get "in clicks" for your web property. Instead of a keyword, you track a placement URL.

Google provides two types of placements:
  1. Automatic -- it chooses the placement URLs that it thinks match your ad, chosen terms, and context -- thus the term "contextual"
  2. Managed -- YOU choose the exact placement URLs that YOU think match your needs

Missing are the Key Metrics for Optimizing Contextual Ads:
  1. Revenue
  2. Margin (revenue - cost)
  3. Margin % (cost / revenue)

It's no easy task to associate revenue to cost. A good back end system is needed.

Requirements:
  • API grabs of Paid Traffic Google / Bing placement data --> into a file, every day for previous day's data.
  • Similar grabs of Revenue associated with your website's revenue partners: like Google Adsense, Yahoo Sponsor Links, Commision Junction afflicate revenue. 
  • Store this revenue into a back end database or file system 
  • Create a method to associate the incoming traffic from your Google or Bing paid campaigns to the outgoing "clicks" on each of the above Ad Revenue partners: requires a custom click ID and traffic tag.
  • Associate the  Paid Traffic from Google / Bing, to the Ad Revenue fields. 
The finished product is a report that roughly has the following fields:
  • Placement URL
  • Placement Type (Managed / Automatic)
  • Impressions
  • Clicks
  • Cost
  • Revenue
  • Margin
  • Margin %
  • CTR
  • RPI (revenue per impression)
  • RPC (revenue per click)
  • Campaign Name
  • Adgroup Name
Key Metrics to optimize Placement Optimizations:
  • Margin%
  • Revenue
  • Cost
  • CTR
  • RPI 

Conclusion:Takes sweat equity, but worth the effort: NO Bid Management system does it.

Monday, June 10, 2013

Big Data for Marketing: Retail Store Example

Big Data

Cost and Size scales up and down based upon need

Big Data grew from a need for speed and size. Now, it's everywhere - running Netflix, iTunes, Ebay, Amazon, our banks, schools. We can get information on customers from re-marketing and affiliate companies like Dotomi, Commission Junction and more. 

It's easier to identify businesses that aren't using Big Data than to list the ones who are. The "Taco's Ensenada" restaurant in Duarte, CA where I frequent for fish tacos is probably not using Big Data, except to blast music from a Mexican Pandora channel. Even my tacos are Big Data influenced.

Big Data is everywhere but its influence and how it benefits our services is not very well understood by consumers, or even by experts in the information industry. 

How different is Big Data? -- A retail clothing store example:


Old System: Relational / Queuing Systems:
  • You're standing in line at H&M and your arms are full of clothes it took an hour to find. There are three lines, and about 30 people waiting. But, there are only 2 cashiers.
  • Everyone waits one at a time for one of the cashiers to free up. The cashier's availability is governed by how quickly they can check out the individual transactions for each person. 
  • One guy in line has 10 shirts and a return -- he's the line hog and everyone is going to have to wait for him. Not his fault.
  • A teenage girl is in line to buy one bracelet and will wait the same amount of time everyone else does. Not her fault.
  • In this model each person waits in a queue to check out. Each is treated as a separate transaction. The time it takes you to check out once you're at the register is determined by  the number of clothes you have, returns, sale items, or your credit card company -- these are sub-transactions. 
  • Checkout Time p/p = Multiply time per sub-transaction by clothes, returns, sales items, credit or cash, and number of people, then divide by 2
New Big Data clothing Store: 
  • Imagine you walk up to the counter at H&M ready to buy 10 items, and there are no cashiers. Then instantly, 10 cashiers pop up -- one for every item.
  • Then, you are physically multiplied by the number of your items and you stand in front of each cashier.
  • All of the transactions are done at once. Each takes no time. 
  • At the end, you're reassembled into one person, you have your receipt, and you leave the store.
  • Imagine this happens for every single customer who will ever buy things.
  • Checkout Time p/p = time to do one transaction, divided by endless computers.
That's Big Data -- cost & performance scale up & down for high & low demand
Big Data: scales up or down in cost and size and performance based upon needs.
Big Data: performance is great at large and small data storage sizes
Big Data: is cost effective because it is designed to scale to needs
Big Data: powers nearly every large online business.