How to Extract Keywords from Google Search Result that Redirect to my Website?

Hello Everyone,

I need to get and extract the Keywords from Google Search Results that Redirect to my Website using PHP in Wordpress Website.

I had tried almost every possible way specially these 3 links which get me nearby to my result but still i am not sure that it is correct or not everytime It gives me the same Result.

The Result i got everytime :
Array ( [domain] => 111284881 [timestamp] => 1514877647 [visits] => 2 [sources] => 2 [campaign] => google [source] => (organic) [medium] => organic [keyword] => (not provided) )

" Not Provided ".

The Solutions i have tried:

  1. Problems extracing keyword from GA cookie
  2. Extracting Keyword information from GA cookie - #10 by AnthonySterling
    3, https://stackoverflow.com/questions/3666473/tracking-traffic-source

Please help me out to resolve the issue.

Thanks you.

1 Like

Can you post the code you are using?

Hello I had tried many codes but every possible solution is similar to this code.

<?php
function parse_google_cookie($__utmz){
    $matches = array();
    preg_match_all(
        '~(ut[^=]+)=([^\\|]+)~i',
        ' __utmz=XXXX.TTTTT.V.C.utmccn=<campaign>|utmcsr=<source>|utmcmd=<medium>|utmctr=<keyword>',
        $matches
    );
    return array_combine((array)$matches[1], (array)$matches[2]);
}

$google_cookie = parse_google_cookie(' __utmz=XXXX.TTTTT.V.C.utmccn=<campaign>|utmcsr=<source>|utmcmd=<medium>|utmctr=<keyword>');
echo $google_cookie['utmctr']; #<keyword>
?>

right now yet i dont find anything just getting the values like __utmz value : 111284881.1514877647.2.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)

Thanks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.