Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript API getAttributionInfo not working #12327

Open
ghost opened this issue Dec 4, 2017 · 1 comment
Open

Javascript API getAttributionInfo not working #12327

ghost opened this issue Dec 4, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 4, 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.)

@lionelB
Copy link

lionelB commented Nov 15, 2019

having the same problem :/ don't know how to make campaign work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants