Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm sending a link to a landing page to a number of different companies and need to be able to tell Google Analytics which company is viewing the page and when. I of course have my original link to the page tagged with UTM parameters accordingly, but I also need to build in a safety net in case someone passes the link around and removes that code.

The URL for the landing page looks like this:


The company_name part is not an actual directory on the server but part of a query string that I'm rewriting into the URI, so I don't believe I will be able to filter on that in Google Analytics. The company_name part will change depending on who I send it to.

So, I need to be able to add some sort of tag or flag in my GA code to tell GA which company is viewing the page.

How might I do that? What are my options?

share|improve this question

migrated from stackoverflow.com Dec 6 '13 at 19:35

This question came from our site for professional and enthusiast programmers.

possible duplicate of How to modify page URL in Google Analytics – popnoodles Dec 6 '13 at 19:29
up vote 1 down vote accepted

Something like this should do the trick:

      1,                   // This custom var is set to slot #1.  Required parameter.
      'Company',     // The name acts as a kind of category for the user activity.  Required parameter.
      $_GET['company_name'],               // This value of the custom variable.  Required parameter.
      2                    // Sets the scope to session-level.  Optional parameter.

That must be called before you call _trackPageview(). You can read more about custom variables here: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCustomVariables

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.