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

Cordova SDK integration #39

Closed
lumierephoto opened this issue Mar 31, 2016 · 10 comments
Closed

Cordova SDK integration #39

lumierephoto opened this issue Mar 31, 2016 · 10 comments

Comments

@lumierephoto
Copy link

I've integrated the Adjust SDK into my project, but how do I know that it is working?

What should I look for in the logs?

Also, can you take a look into how I inserted the code to call the Adjust SDK in my index.js and if it is correct:

var app = {
    initialize: function() {
    this.bindEvents();
},
bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
    app.receivedEvent('deviceready');

    var adjustConfig = new AdjustConfig("APP_TOKEN", AdjustConfig.EnvironmentSandbox);

    Adjust.create(adjustConfig);
},
receivedEvent: function(id) {
    var parentElement = document.getElementById(id);
    var listeningElement = parentElement.querySelector('.listening');
    var receivedElement = parentElement.querySelector('.received');

    listeningElement.setAttribute('style', 'display:none;');
    receivedElement.setAttribute('style', 'display:block;');

    console.log('Received Event: ' + id);
 }
};
@uerceg
Copy link
Contributor

uerceg commented Apr 1, 2016

Hi @lumierephoto and thank you for opening this issue.

As far as I see, everything looks good. My advice would be to turn log level to verbose so that you can see all the logs which our SDK prints. You can adapt your initialisation code to look something like this:

var adjustConfig = new AdjustConfig("APP_TOKEN", AdjustConfig.EnvironmentSandbox);
adjustConfig.setLogLevel(AdjustConfig.LogLevelVerbose);
Adjust.create(adjustConfig);

I run example app on iPhone usually like this:

cordova ios clean && cordova build ios && cordova run ios --device

After running it, you can open Xcode, choose Window --> Device and check your device's logs. Here's how it looks in my case and notice red selected part which says that install has been tracked.

screen shot 2016-04-01 at 14 55 32

Let me know if you need any further assistance.

Cheers

@lumierephoto
Copy link
Author

I followed your instructions but I'm not getting any logs in the Windows -> Devices.

Here is my index.js updated with the new line of code:

 var app = {
     initialize: function() {
      this.bindEvents();
  },

bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
},

onDeviceReady: function() {
    app.receivedEvent('deviceready');

    //  Adjust SDK Configure
    var adjustConfig = new AdjustConfig("APP_TOKEN", AdjustConfig.EnvironmentSandbox);

      adjustConfig.setLogLevel(AdjustConfig.LogLevelVerbose);
      Adjust.create(adjustConfig);
   },

  receivedEvent: function(id) {
    var parentElement = document.getElementById(id);
    var listeningElement = parentElement.querySelector('.listening');
    var receivedElement = parentElement.querySelector('.received');

    listeningElement.setAttribute('style', 'display:none;');
    receivedElement.setAttribute('style', 'display:block;');

    console.log('Received Event: ' + id);
  }
};

Where are you putting this code in your app demo?

var adjustConfig = new AdjustConfig("APP_TOKEN", AdjustConfig.EnvironmentSandbox);
adjustConfig.setLogLevel(AdjustConfig.LogLevelVerbose);
Adjust.create(adjustConfig);

@lumierephoto
Copy link
Author

Also, do you have a link to your AdjustDemo Cordova project so I can see how you did it?

@lumierephoto
Copy link
Author

This is the only log that I get in Xcode for the SDK:

  2016-04-01 13:43:42.459 Solitaire[1667:73436] [CDVTimer][adjust] 2.776980ms

@uerceg
Copy link
Contributor

uerceg commented Apr 1, 2016

Sure, example app is not something which is such a big secret, we're just not keeping it at the moment in the repository due to its big size. You can download it temporary from here: [no longer valid link]

Let me know once you have downloaded it.

@lumierephoto
Copy link
Author

Thanks, I downloaded it.

@uerceg
Copy link
Contributor

uerceg commented Apr 1, 2016

Great. Just please instead of string I wrote ({YourAppToken}) write actually your app token. BTW, I have edited your upper posts with code to hide your actual app token which you pasted.

@uerceg
Copy link
Contributor

uerceg commented May 13, 2016

@lumierephoto Any update on this issue?

@uerceg
Copy link
Contributor

uerceg commented Nov 1, 2016

Closing the issue due to inactivity.

@lumierephoto Feel free to reopen the issue if you still face this issue.

@uerceg uerceg closed this as completed Nov 1, 2016
@NagendraMNK
Copy link

[no longer valid link]

I am facing same issue, [CDVTimer][adjust] 0.084996ms

Could you please help me here, because of this, creat events are not working

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

3 participants