Skip to content

Instantly share code, notes, and snippets.

@luisabarca
Last active August 29, 2015 13:57

Revisions

  1. Luis Abarca revised this gist Mar 5, 2014. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions Piwik user tracking
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,17 @@
    <?php
    $uname = 'Unknow';
    $uname = '';
    $user =& JFactory::getUser();

    if ($user) {
    if ( is_object($user) ) {
    $uname = $user->name;
    }
    ?>
    <!-- Piwik -->
    <script type="text/javascript">
    var _paq = _paq || [];
    <?php if (!empty($uname)): ?>
    _paq.push(["setCustomVariable", 1, 'User', '<?php echo $uname; ?>', "visit"]);
    <?php endif ?>
    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);

  2. Luis Abarca revised this gist Mar 5, 2014. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions Piwik user tracking
    Original file line number Diff line number Diff line change
    @@ -13,9 +13,6 @@ if ($user) {
    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);

    piwikTracker.setCustomVariable(2, 'UserName', '<?php echo $uname; ?>', 'visit');
    piwikTracker.trackPageView();

    (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://enovate.us/";
    _paq.push(["setTrackerUrl", u+"piwik.php"]);
  3. Luis Abarca revised this gist Mar 5, 2014. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions Piwik user tracking
    Original file line number Diff line number Diff line change
    @@ -9,11 +9,12 @@ if ($user) {
    <!-- Piwik -->
    <script type="text/javascript">
    var _paq = _paq || [];
    _paq.push(["setCustomVariable", 1, 'User', '<?php echo $uname; ?>', "visit"]);
    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);
    _paq.push(["enableLinkTracking"]);

    piwikTracker.setCustomVariable(1, 'User', '<?php echo $uname; ?>', 'visit' );
    _paq.push(["setCustomVariable", 1, 'User', '<?php echo $uname; ?>', "visit"]);
    piwikTracker.setCustomVariable(2, 'UserName', '<?php echo $uname; ?>', 'visit');
    piwikTracker.trackPageView();

    (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://enovate.us/";
  4. Luis Abarca revised this gist Mar 5, 2014. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions Piwik user tracking
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    <?php
    $uname = '';
    $uname = 'Unknow';
    $user =& JFactory::getUser();

    if ($user) {
    @@ -12,9 +12,8 @@ if ($user) {
    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);

    <?php if (!empty($uname)): ?>
    piwikTracker.setCustomVariable(1, 'User', '<?php echo $uname; ?>', 'visit' );
    <?php endif ?>
    _paq.push(["setCustomVariable", 1, 'User', '<?php echo $uname; ?>', "visit"]);

    (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://enovate.us/";
  5. Luis Abarca created this gist Mar 5, 2014.
    26 changes: 26 additions & 0 deletions Piwik user tracking
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    <?php
    $uname = '';
    $user =& JFactory::getUser();

    if ($user) {
    $uname = $user->name;
    }
    ?>
    <!-- Piwik -->
    <script type="text/javascript">
    var _paq = _paq || [];
    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);

    <?php if (!empty($uname)): ?>
    piwikTracker.setCustomVariable(1, 'User', '<?php echo $uname; ?>', 'visit' );
    <?php endif ?>

    (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://enovate.us/";
    _paq.push(["setTrackerUrl", u+"piwik.php"]);
    _paq.push(["setSiteId", "2"]);
    var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
    g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
    })();
    </script>