Forum Gündemi:


Konu Başlığı : [PHP] Google Analitik ID Bulucu

*
Bu konu; tarihinde açılmış olup, 0 defa yorumlanmıştır.
Konu Sahibi : oxcakmak
Konuyu Değerlendir
  • 0 Oy - 0 Ortalama
  • 1
  • 2
  • 3
  • 4
  • 5
Çevrimdışı
Back-End Developer
******
105
mesajlar
82
konular
0
(Ticaret Puanı: )
Aug 2019
(Kayıt Tarihi)
#1
08-05-2019, 02:30 PM
Kodlar:
PHP Kod:
function fetchGoogleAnalyticsUAID($googleAnalyticsURL){
    // Script Regex
    $script_regex "/<script\b[^>]*>([\s\S]*?)<\/script>/i"
    // UA_ID Regex
    $ua_regex "/UA-[0-9]{5,}-[0-9]{1,}/";
    // Preg Match for Script
    // Extract all the script tags of the content
    preg_match_all($script_regexfile_get_contents($googleAnalyticsURL), $inside_script); 
    // Check for ga.gs and _trackPageview in all <script> tag
    for ($i 0$i count($inside_script[0]); $i++){
        if (stristr($inside_script[0][$i], "ga.js")) $flag2_ga_js TRUE;
    }
    // Preg Match for UA ID
    // Extract UA-ID using regular expression
    preg_match_all($ua_regexfile_get_contents($googleAnalyticsURL), $ua_id);
    // Return UA ID
    return $ua_id[0][0];


Kullanımı:
PHP Kod:
echo fetchGoogleAnalyticsUAID("website_url"); 
[Linkleri yalnızca üyeler görüntüleyebilir.Sizde aramıza katılmak ister misiniz? Üye Olmak İçin Buraya Tıklayın.]


Foruma Git:


Görüntüleyenler: 1 Ziyaretçi