Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

getReferrer getCampaignData function returns null #35

Closed
sumeetbasak opened this issue Mar 2, 2014 · 8 comments
Closed

getReferrer getCampaignData function returns null #35

sumeetbasak opened this issue Mar 2, 2014 · 8 comments
Assignees
Labels

Comments

@sumeetbasak
Copy link

While testing the Campaign Tracking branch, i realised that the getReferrer and getCampaignData returns null even though the log cat shows Google Analytics receiving the referral info via adb.
Any idea how i can get the same referral information in actionscript?
I could not get the ANE Google Analytics Demo to work - there were no build.xml to build the project and i was clueless on building it.
Let me know if you need specific information, my implementation was as follows:

import eu.alebianco.air.extensions.analytics.Analytics;
import flash.events.Event;
import flash.text.TextField;
import eu.alebianco.air.extensions.analytics.api.ITracker;
import flash.events.MouseEvent;

var referrer:String;
var campData:String;
var dText:TextField;
var tracker:ITracker;

stage.addEventListener(MouseEvent.CLICK, appLoaded);

if (Analytics.isSupported())
{
        tracker = Analytics.getInstance().getTracker("UA-38007869-10");
        dText.appendText("tracker added: "+tracker);
}
else
{
        dText.appendText("NOT SUPPORTED");
}

function appLoaded(e:MouseEvent)
{
        try
        {
                trace("ehh "+tracker);
                referrer = tracker.getReferrer();
                campData = tracker.getCampaignData();
                dText.appendText("referrer: "+referrer+"\n");
                dText.appendText("campData: "+campData+"\n");
        }
        catch (e)
        {
                throw new Error("some jhol");
        }

}
@alebianco alebianco self-assigned this Mar 2, 2014
@alebianco
Copy link
Owner

it is possible that it's not working properly yet (as it is still in development/testing and all) altought it's strange because i've been using it quite regurarly and it seemed to be working, on Android at least.

for the campaign it's more about the app descriptor file (check the demo one under the build folder) and how you launch the app.

I'll put down a task to detail how to build the demo but it be quite straightforward ...

PS: please use pastebin or something like that if you need to past code, logs or that sort of stuff

@sumeetbasak
Copy link
Author

May be it has something to do with the air version.
the app.xml looks like this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<application xmlns="http://ns.adobe.com/air/application/3.7">
    <id>flashcampaignTracking</id>
    <versionNumber>1.0.0</versionNumber>
    <filename>flash_campaignTracking</filename>
    <description></description>
    <name>flash_campaignTracking</name>
    <copyright></copyright>
    <initialWindow>
        <content>flash_campaignTracking.swf</content>
        <systemChrome>standard</systemChrome>
        <transparent>false</transparent>
        <visible>true</visible>
        <fullScreen>true</fullScreen>
        <autoOrients>false</autoOrients>
        <aspectRatio>portrait</aspectRatio>
        <renderMode>cpu</renderMode>
    </initialWindow>
    <customUpdateUI>false</customUpdateUI>
    <allowBrowserInvocation>false</allowBrowserInvocation>
    <icon></icon>
    <versionLabel></versionLabel>
    <extensions>
        <extensionID>eu.alebianco.air.extensions.analytics.NativeGATracker</extensionID>
    </extensions>
    <android>
        <manifestAdditions><![CDATA[
            <manifest android:installLocation="auto">
                <uses-permission android:name="android.permission.INTERNET" />
                <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
                <application android:enabled="true" android:debuggable="true">
                    <activity android:excludeFromRecents="false">
                        <intent-filter>
                            <action android:name="android.intent.action.MAIN"/>
                            <category android:name="android.intent.category.LAUNCHER"/>
                        </intent-filter>
                    </activity>
                    <service android:name="com.google.analytics.tracking.android.CampaignTrackingService"/>
                    <receiver android:name="com.google.analytics.tracking.android.CampaignTrackingReceiver" android:exported="true">
                      <intent-filter>
                        <action android:name="com.android.vending.INSTALL_REFERRER" />
                      </intent-filter>
                    </receiver>
                </application>
            </manifest>
        ]]></manifestAdditions>
    </android>

</application>

I realised, that you did not add the INSTALL_REFERRER. if i don't add the INSTALL_REFERRER, GATracker is not activated.

@alebianco
Copy link
Owner

Yes, the INSTALL_REFERRER is needed if you want to get the google store installs informations.
you'll also need the additional intent-filter with the url scheme if you want to launch your other links containing campaign data.
All of this will be obviously documented once I merge into master and that won't happen until I'm happy about how it works ...

Going back to your issue, now that you have the install referrer are you able to get the information? How are you testing it?

@sumeetbasak
Copy link
Author

I am testing it the way Google suggests.
I use adb to broadcast the INSTALL_REFERRER intent to the specific app and track it in logcat.
The log cat shows campaign data received, but the flash variables print null in the textfields.

@alebianco
Copy link
Owner

that is "correct".
i have no way of accessing the campaign information store by the install referrer, but they will be tracked with the next hits. check the data being sent to the analytics servers to verify.

those methods are only useful when launching the app from a url containing campaign data, for which you need the intent filter with the url scheme.

@lightmar
Copy link

Thanks for this great extension.
Are the getReferrer() and getCampaignData() methods already available in the current release?

@sumeetbasak
Copy link
Author

Hey! been long i caught back on this project.
From what i knew last, the Campaign Tracking was still being tested and developed!
I understand that this part is complete and functional now? would love to try it out on an upcoming project.

@alebianco
Copy link
Owner

please check #51 for updates from now on

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

No branches or pull requests

3 participants