Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1057517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:52:52+00:00 2026-05-16T17:52:52+00:00

Does Google Analytics store the utm_source, utm_medium paramaters in a cookie or something similar

  • 0

Does Google Analytics store the utm_source, utm_medium paramaters in a cookie or something similar that I can access on my own site using PHP? – OR – does anyone have an example of code I could use to identify a traffic source ie. PPC, Natural etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:52:53+00:00Added an answer on May 16, 2026 at 5:52 pm

    Yes, Google stores this information in a cookie; specifically, the __utmz cookie.

    You can write a piece of JavaScript to read the cookies that GA stores in the browser. This information is stored in the __utmz cookie. For example, if a link contained all 5 possible utm variables, the cookie would look something like this (I’ve substituted the capitalized names for the values, so SOURCE is the value for utm_source:

         43838368.1283957505.1.3.utmcsr=SOURCE|utmccn=CAMPAIGN|utmcmd=MEDIUM|utmctr=TERM|utmcct=CONTENT
    

    This is what a __utmz cookie looks like for an organic google search:

    140029553.1283957328.2.136.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=SEARCH-TERMS-HERE
    

    This is what a __utmz cookie looks like for a direct visit:

       17861479.1283957910.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
    

    This is what a __utmz cookie looks like for paid google search with autotagging:

       175516223.1283957996.1.1.utmgclid=CLrr7fyL-KMCFZpN5QoduVOTLA|utmccn=(not%20set)|utmcmd=(not%20set)|utmctr=SEARCH+TERM
    

    PHP is not ideal, since you could never read the cookie on single-page-visits, but here is what the code could look like in PHP.

    if(isset($_COOKIE['__utmz']))
    {
    $cookie= $_COOKIE['__utmz'];
    $params =  strstr($cookie, 'utm');
    $cookiearray = explode("|", $params);
    $final = array();
    for($i=0; $i<count($cookiearray); $i++)
    {
        $temp = explode("=",$cookiearray[$i]);
        $final[$temp[0]] = temp[1];
    }
    }
    

    This would give you an array ($final) with key-value matches for each traffic source parameter.

    You’d probably be better off parsing this in JavaScript and posting it to your server using AJAX, rather than reading it on the server-side, since you could only do that on the second page view, and would thus lose the ability to track single-page-view users. This can be an annoying task with manual JavaScript, because both cookies and AJAX can be inconsistent across browsers, so I would recommend a framework like jQuery.


    Here’s the approach I would take using jQuery. I’d add the jQuery cookie plugin, and post it within a _gaq.push(function(){...}); clause like this (assuming that the PHP above is stored in handler.php).

    $.post('handler.php', '__utmz' : $.cookie("__utmz") );
    

    Then, switch the two references of $_COOKIE to $_POST, and do whatever you want with the array it produces.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 524k
  • Answers 524k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you loading the image file to QImage and then… May 16, 2026 at 9:52 pm
  • Editorial Team
    Editorial Team added an answer As others have said, always use braces. However, there's one… May 16, 2026 at 9:52 pm
  • Editorial Team
    Editorial Team added an answer Looks like a regular ListView with the View property =… May 16, 2026 at 9:52 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm working on a project here that will store some info in Google Analytics
I need to make something like google-analytics, I mean that it has to be
can someone to some resources for google analytics.i.e,where it can be used what all
I am interested in tracking my users' pageviews on my site. Being that traffic
I'm the primary tech guy for an e-commerce site that gets 700k pageviews/mo. and
The Google Analytics setup instructions state: This tracking code snippet should be included in
The Async Tracking code in Google Analytics looks like this: var _gaq = _gaq
I am trying to build URLs for Google Analytics and Omniture. GA is simple
I was just wondering the general idea how the embedded Google Analytics Javascript works?
I'm looking for a google search module that uses the 'Google Custom Search API'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.