insert-affiliate-react-native-sdk 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DeepLinkIapProvider.js +2 -1
- package/package.json +1 -1
- package/readme.md +42 -0
- package/src/DeepLinkIapProvider.tsx +2 -1
|
@@ -312,7 +312,7 @@ const DeepLinkIapProvider = ({ children, iapSkus, iapticAppId, iapticAppName, ia
|
|
|
312
312
|
try {
|
|
313
313
|
if (!referrerLink || !userId) {
|
|
314
314
|
console.warn("[Insert Affiliate] No affiliate identifier found. Please set one before tracking events.");
|
|
315
|
-
return;
|
|
315
|
+
return Promise.resolve();
|
|
316
316
|
}
|
|
317
317
|
const payload = {
|
|
318
318
|
eventName,
|
|
@@ -330,6 +330,7 @@ const DeepLinkIapProvider = ({ children, iapSkus, iapticAppId, iapticAppName, ia
|
|
|
330
330
|
}
|
|
331
331
|
catch (error) {
|
|
332
332
|
console.error("[Insert Affiliate] Error tracking event:", error);
|
|
333
|
+
return Promise.reject(error);
|
|
333
334
|
}
|
|
334
335
|
});
|
|
335
336
|
(0, react_1.useEffect)(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insert-affiliate-react-native-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "A package that will give context having implementation of react-native-branch and react-native-iap and iaptic validate api.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/readme.md
CHANGED
|
@@ -122,3 +122,45 @@ const App = () => {
|
|
|
122
122
|
export default App;
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
+
|
|
126
|
+
## Event Tracking (Beta)
|
|
127
|
+
|
|
128
|
+
The **InsertAffiliateReactNative SDK** now includes a beta feature for event tracking. You can use this feature to track specific user actions within your app. However, please note that this feature is currently in beta, and while we aim to secure its functionality, we cannot guarantee that it is fully resistant to tampering or manipulation at this stage.
|
|
129
|
+
|
|
130
|
+
### Using `trackEvent`
|
|
131
|
+
|
|
132
|
+
To track an event, then use the `trackEvent` function. Make sure to open an Affiliate's deep link before tracking the event; otherwise, event tracking won’t work. Here’s an example:
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
const {
|
|
136
|
+
referrerLink,
|
|
137
|
+
subscriptions,
|
|
138
|
+
iapLoading,
|
|
139
|
+
handleBuySubscription,
|
|
140
|
+
userId,
|
|
141
|
+
userPurchase,
|
|
142
|
+
isIapticValidated,
|
|
143
|
+
trackEvent, // Required for trackEvent
|
|
144
|
+
} = useDeepLinkIapProvider();
|
|
145
|
+
|
|
146
|
+
<Button
|
|
147
|
+
title={'track event'}
|
|
148
|
+
onPress={() => {
|
|
149
|
+
trackEvent('event_name')
|
|
150
|
+
.then(() => console.log('Event tracked successfully!'))
|
|
151
|
+
}}
|
|
152
|
+
/>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Example Usage
|
|
156
|
+
Set the Affiliate Identifier (required for tracking):
|
|
157
|
+
|
|
158
|
+
```swift
|
|
159
|
+
InsertAffiliateSwift.setInsertAffiliateIdentifier(referringLink: "your_affiliate_link")
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### Track an Event:
|
|
163
|
+
|
|
164
|
+
```swift
|
|
165
|
+
InsertAffiliateSwift.trackEvent(eventName: "user_signup")
|
|
166
|
+
```
|
|
@@ -380,7 +380,7 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
380
380
|
console.warn(
|
|
381
381
|
"[Insert Affiliate] No affiliate identifier found. Please set one before tracking events."
|
|
382
382
|
);
|
|
383
|
-
return;
|
|
383
|
+
return Promise.resolve();
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
const payload = {
|
|
@@ -405,6 +405,7 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
405
405
|
}
|
|
406
406
|
} catch (error) {
|
|
407
407
|
console.error("[Insert Affiliate] Error tracking event:", error);
|
|
408
|
+
return Promise.reject(error);
|
|
408
409
|
}
|
|
409
410
|
};
|
|
410
411
|
|