Skip to content

tanshio/phpAnalyticsIP

Repository files navigation

phpAnalyticsIP

Set IP and Cookie to Google Analytics.

original:Analytics IP

Original is great but it does not support cross-domain.

Create custom dimension

set up custom dimension

custom dimention list

Set up

code

If the index of IP Address is 6

ga('set', 'dimension6', setAnalytics.getIP());

Method

setAnalytics.getIP()

→ex. XXX.XXX.XXX.XXX

setAnalytics.getCookie()

→MD5 hash

setAnalytics.getAccessTime()

→ex. 2014/05/28 12:04:42

Option

Secure

<script type="text/javascript" src="./analytics.php?s=X"></script>

Google Tag Manager

Macro

  • setIP
  • setCookie
  • setAccessTime

code

  • setAnalytics_event

code

code

Custom Dimension

code

Rule

code

Support

PHP

analytics.min.php and analytics.tag.min.php support is more than PHP5.4

If an error message displays.

date(): It is not safe to rely on the system's timezone settings.

php.ini add

date.timezone = Asia/Tokyo

javascript

  • analytics_cookie.js
  • analytics_cookie.min.js
  • analytics_cookie.tag.js
  • analytics_cookie.tag.min.js

setIP() and secure don't support.

Changelog

July 22,2014 Change expire settings.

December 5,2014 Typo modified.

About

IP and Cookie set Google Analytics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published