Error in iOS SDK React Native

We get errors in build stage and can’t open the app. So tracking won’t work.

Errors:

  • execution failed for task compiledebugkotlin
  • java.lang.overflowerror

How can we solve this problem?

@DoroWunderle We’re aware of this issue and working on resolving it.
It will be available in the next few working days.
We will let you know in this thread once the fixed version is released.
Apologies for the inconvenience.

@mandrzej, do you have any news on that?

@DoroWunderle We’ve released version 1.0.6 of the React Native SDK, in which we’ve added support for native iOS SDK version 1.1.8 and Android SDK version 1.1.10. Please download the latest version and check if the issue has been resolved.

1 Like

Thanks @mandrzej
We implemented Piwik in the application and to check whether it is working we console log some variables. Here some of them:

	Piwik Pro SDK has been already initialized
	currentUserId:  Bilal
	currentVisitorId:  917c47ee3df52845

We are tracking users with custom events such as:

    const options = {
      title: ‘actionTitle’,
      customDimensions: {1: ‘some custom dimension value’},
    };
    const trackScreen = await PiwikProSdk.trackScreen(`Route Screen`, options);

But we don’t see any event, user, etc. in the dashboard and debugger. What is the problem? What should we do to get the analytics ?

Hi, @DoroWunderle could you please show how you import our library and initialization code?

@Daniel_Twork

import PiwikProSdk from ‘@piwikpro/react-native-piwik-pro-sdk’;

const initializePiwik = async () => {
    try {
      const piwikResult = await PiwikProSdk.init(‘URL’, ‘PASSWORD’);
      console.log(‘piwikResult: ’, piwikResult);
    } catch (err) {
      console.log(‘err ’, err);
    }
    await PiwikProSdk.startNewSession();
  };

useEffect(() => {
    trackUserExample
  }, []);
  const trackUserExample = async () => {
    const options = {
      title: ‘actionTitle’,
      customDimensions: {1: ‘some custom dimension value’},
    };
    const trackScreen = await PiwikProSdk.trackScreen(`Route Screen`, options);
    console.log(‘trackScreen: ’, trackScreen);
  };



To be sure, in place of PASSWORD you insert site-id?

you have to call init method passing a server address and website ID (you can find it in AdministrationSites & apps):

import PiwikProSdk from "@piwikpro/react-native-piwik-pro-sdk";

PiwikProSdk.init('https://your.piwik.pro.server.com', '01234567-89ab-cdef-0123-456789abcdef');

Please check if the example demo application works for you. You can find it here:

If possible, prepare a minimal demo application that does not work, where you initialise the SDK and run a method. After sending code to us, we can do a code review and send you a corrected version.

1 Like

Hi Daniel_Twork,
We tried your small demo in our project but it is not working. We are using the latest version of Piwik in React Native. Here is the configurations:
import PiwikProSdk from ‘@piwikpro/react-native-piwik-pro-sdk’;

useEffect(() => {
initializePiwikProSdk();
}, );

const initializePiwikProSdk = async () => {
await PiwikProSdk.init(
https://upvisit-web.containers.piwik.pro’,
‘xxxxxxxx-4684-4aa6-a42a-xxxxxxxxxxxx’, //x is for hiding some characters in the site-id
)
.then(() => console.log(‘success’))
.catch(error => console.log('error.message: ', error.message));
await PiwikProSdk.trackApplicationInstall();

const dispatchInterval = await PiwikProSdk.getDispatchInterval();
const currentUserId = await PiwikProSdk.getUserId();
const currentUserEmail = await PiwikProSdk.getUserEmail();
const currentSessionTimeout = await PiwikProSdk.getSessionTimeout();
const currentVisitorId = await PiwikProSdk.getVisitorId();
console.log('dispatchInterval: ', dispatchInterval);
console.log('currentUserId: ', currentUserId);
console.log('currentUserEmail: ', currentUserEmail);
console.log('currentSessionTimeout: ', currentSessionTimeout);
console.log('currentVisitorId: ', currentVisitorId);

setTimeout(() => {
  trackSearch();
  trackScreenWithCustomDimensions();
}, 5000);

};
const customDimensions = {
1: ‘beta’,
2: ‘gamma’,
};
const visitCustomVariables = {4: {name: ‘food’, value: ‘pizza’}};
const trackSearch = async () => {
const options = {
visitCustomVariables,
category: Movies,
count: 3,
// customDimensions,
};

try {
  await PiwikProSdk.trackSearch(`Space1`, options);
  console.log('Track search');
} catch (error) {
  console.log('error.message: ', error.message);
}

};

const trackScreenWithCustomDimensions = async () => {
const options = {
title: ‘customDimensions’,
customDimensions,
};

try {
  await PiwikProSdk.trackScreen(`your_activity_path2`, options);
  console.log('Track screen');
} catch (error) {
  console.log('error.message: ', error.message);
}

};

We also put a button and when this button is clicked, we trigger the track event but again there is nothing in the dashboard. We looked at the server and site-id and they are correct.
These are the console logs:
LOG success
LOG dispatchInterval: 30
LOG currentUserId: undefined
LOG currentUserEmail: undefined
LOG currentSessionTimeout: 1800
LOG currentVisitorId: 5eb23654e92b0a89
LOG Track search
LOG Track screen

React Native version: 0.70.0
React Version: 18.1.0
Piwik Version: ^1.0.6

Thank you for sending the code. Try using the url as:

'https://upvisit-web.piwik.pro'

1 Like

Thank you very much. It worked :+1:

1 Like