{"id":21111,"date":"2019-10-25T08:49:35","date_gmt":"2019-10-24T22:49:35","guid":{"rendered":"https:\/\/thirstyaff.wpengine.com\/?post_type=knowledgebase&#038;p=21111"},"modified":"2024-04-16T12:57:04","modified_gmt":"2024-04-16T16:57:04","slug":"how-to-track-geo-ip-stats-when-cloudflare-is-enabled","status":"publish","type":"ht_kb","link":"https:\/\/thirstyaffiliates.com\/de\/docs\/how-to-track-geo-ip-stats-when-cloudflare-is-enabled","title":{"rendered":"Wie man Geo IP-Statistiken verfolgt, wenn Cloudflare aktiviert ist"},"content":{"rendered":"<p>Cloudflare masks the IP address of the user and moves it to another HTTP header.<\/p>\n<p>To make it compatible with ThirstyAffiliate&#8217;s stats collection module you will need to add the following snippet of code to your functions.php file or a drop-in plugin.<\/p>\n<pre lang=\"php\">function ta_cloudflare_ip_compatibility( $ip ) {\r\n    if ( ! empty( $_SERVER['HTTP_CF_CONNECTING_IP'] ) )\r\n            $ip = $_SERVER['HTTP_CF_CONNECTING_IP'];\r\n    return $ip;\r\n}\r\nadd_filter( 'ta_get_user_ip_address' , 'ta_cloudflare_ip_compatibility' , 10 , 1 );\r\n<\/pre>\n<p>This will be added as a feature to ThirstyAffiliates in the future.<\/p>\n<p>&nbsp;<\/p>\n<p>Add the following snippet of code to your functions.php file or a drop-in plugin for the Geolocations module when redirecting:<\/p>\n<pre class=\"c-mrkdwn__pre\" data-stringify-type=\"pre\">function get_proper_ip_from_cf_for_ta_geo($address) {\r\n\tif(isset($_SERVER['HTTP_CF_CONNECTING_IP']) &amp;&amp; !empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {\r\n\t\t$address = $_SERVER['HTTP_CF_CONNECTING_IP'];\r\n\t}\r\n\treturn $address;\r\n}\r\nadd_filter('tap_geolocation_client_ip', 'get_proper_ip_from_cf_for_ta_geo');<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cloudflare maskiert die IP-Adresse des Benutzers und verschiebt sie in einen anderen HTTP-Header. Um die Kompatibilit\u00e4t mit dem Statistiksammelmodul von ThirstyAffiliate herzustellen, m\u00fcssen Sie den folgenden Codeschnipsel zu Ihrer functions.php-Datei oder einem Drop-in-Plugin hinzuf\u00fcgen. function ta_cloudflare_ip_compatibility( $ip ) { if ( !<\/p>\n<p><a class=\"read-more\" href=\"https:\/\/thirstyaffiliates.com\/de\/docs\/how-to-track-geo-ip-stats-when-cloudflare-is-enabled\">Mehr lesen<\/a><\/p>","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"om_disable_all_campaigns":false,"_strive_editorial_status":"not-started","_strive_copy_of":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"ht-kb-category":[497,498],"ht-kb-tag":[],"class_list":["post-21111","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-thirstyaffiliates-free-version","ht_kb_category-thirstyaffiliates-pro"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/thirstyaffiliates.com\/de\/wp-json\/wp\/v2\/ht-kb\/21111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thirstyaffiliates.com\/de\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/thirstyaffiliates.com\/de\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/thirstyaffiliates.com\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thirstyaffiliates.com\/de\/wp-json\/wp\/v2\/comments?post=21111"}],"version-history":[{"count":0,"href":"https:\/\/thirstyaffiliates.com\/de\/wp-json\/wp\/v2\/ht-kb\/21111\/revisions"}],"wp:attachment":[{"href":"https:\/\/thirstyaffiliates.com\/de\/wp-json\/wp\/v2\/media?parent=21111"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/thirstyaffiliates.com\/de\/wp-json\/wp\/v2\/ht-kb-category?post=21111"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/thirstyaffiliates.com\/de\/wp-json\/wp\/v2\/ht-kb-tag?post=21111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}