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 7618407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:23:45+00:00 2026-05-31T03:23:45+00:00

I am using a sweet little function to track visitors to my site and

  • 0

I am using a sweet little function to track visitors to my site and dump the info to Salesforce. However many form submissions have (none) set for many values because (as I understand it) the cookie is not set until the second page load.

I have tested this and that seems to be accurate, the problem is many people fill out a form on the first page, and I don’t get any info through these submissions.

I am loading GA as follows:

  <script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-29066630-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script');
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
        'http://www') + '.google-analytics.com/ga.js';
    ga.setAttribute('async', 'true');
    document.documentElement.firstChild.appendChild(ga);
  })();


</script>

And then running a php function to parse the __utmz cookie apart:

function tracking_cookie() { // ver 1.5
    $trackarr   = split('[|]',$_COOKIE["__utmz"]);
    $conversion = $_COOKIE["Conversion"];

    for($i=0;$i<count($trackarr);$i++){
        $keyvalues=split('[=]',$trackarr[$i]);
        $key=substr($keyvalues[0],-6);      
        switch ($key){
            case "utmcsr":
                $cookie['SearchEngine']     =   $keyvalues[1];break;
            case "utmccn":
                $cookie['SearchCampaign']   =   $keyvalues[1];break;
            case "utmcmd":
                $cookie['SearchType']       =   $keyvalues[1];break;
            case "utmcct":
                $cookie['AdText']           =   $keyvalues[1];break;
            case "utmctr":
                $cookie['Keyword']          =   $keyvalues[1];break;
            case "mgclid":
                $cookie['isPPC']            =   $keyvalues[1];break;
        }
    }

I have more code running after this. Any ideas on how to force the cookie to load the first time around?

  • 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-31T03:23:47+00:00Added an answer on May 31, 2026 at 3:23 am

    A cookie isn’t readable until the second page load – because they get sent in the request.

    What you could do is on the initial page load (and no _utmz cookie is found in PHP) append another JS file / invoke some JS that will run an ajax command back to your server after the page has loaded.

    This will act as the second page load and should have access to the new cookie (and the user wouldn’t have left the page)

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

Sidebar

Related Questions

I have created Excel Sheet using Java program. It works fine. My problem is,
I have just Extracted the cells from the excel sheet using Apache POI, everything
I'm using an Excel sheet to keep track of a particular time series (my
I add many check boxes to the excel sheet programaticaly using the following code:
I just added printing capability to a web site using a style sheet (ie.
I'm having a little trouble with losing my array order after using unset() .
So I'm using jqGrid with my mvc.net / Ling2Sql prototype site that I'm making
I have this little test-case which is supposed to show two widgets, with one
I'm experimenting with MongoDB using the PHP PECL extension, however I'm having difficulty getting
Hello recently I am using sweet pages pagination for my website. I want to

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.