@fh-foundervision opened this Issue on December 4th 2017

Hi

I'm trying to read the Visitors Campaign from PiwikTracker. In the Docs i found getAttributionInfo ( getAttributionCampaignName, ... ), but all these Methods don't return anything useful.

Piwik 3.2.0

Request: http://mydomain.com/index.html?pk_campaign=Test&pk_keyword=Page

index.html

<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Test Page</title>
</head>
<body>
    <h1>Test Page</h1>

    <!-- Piwik -->
    <script type="text/javascript">
        var _campaignName;
        var _attributionInfo;

        var _paq = _paq || [];
        _paq.push(["trackPageView"]);
        _paq.push(["enableLinkTracking"]);
        _paq.push([function(){
            _campaignName = this.getAttributionCampaignName();
            _attributionInfo = this.getAttributionInfo();
        }]);

        (function() {
            var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.mydomain.com/";
            _paq.push(["setTrackerUrl", u+"piwik.php"]);-
            _paq.push(["setSiteId", 1]);
            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>
    <!-- End Piwik Code -->
</body>
</html>

( The Visit is tracked with Campaign and Keyord. ... visible in analytics )

Result of the getAttribution* -Methods:

_campaignName = undefined
_attributionInfo = [ "", "", 0, "" ];

Expected:

_campaignName = "Test"
_attributionInfo = ["Test", "Page", 0, ""] // at least not empty

Either this is a bug or i'm missing some point.

(Tested in Chrome (62) and Firefox (57) on Kubuntu.)

Powered by GitHub Issue Mirror