--- title: "Reusing Google Analytics tagging" slug: "reusing-google-analytics-tagging" updated: 2026-06-09T22:48:37Z published: 2026-06-09T22:48:37Z canonical: "docs.xtremepush.com/reusing-google-analytics-tagging" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.xtremepush.com/llms.txt > Use this file to discover all available pages before exploring further. # Reusing Google Analytics tagging You can reuse your Google Analytics data to target your users with the [Xtremepush Google Analytics Integration](/documentation/docs/google-analytics-4). To enable this you will need to do some work on the App-side and on the Platform. ## App-side ### iOS To enable the Google Analytics targeting feature, call the following method with the Google Analytics ID as the second param where this is available: **Swift** ```swift // iOS enable google analytics targeting XPush.hitTag("user.ga_id", withValue:GA_ID); ``` **Objective-C** ```objectivec // iOS enable google analytics targeting [XPush hitTag:@"user.ga_id" withValue: GA_ID]; ``` The Google Analytics ID can be retrieved using the following method from the GA SDK. **Swift** ```swift tracker.get(kGAIClientId) ``` **Objective-C** ```objectivec [tracker get:kGAIClientId] ``` This ID should also be set as a custom dimension on the GA tracker **Swift** ```swift // Set the custom dimension value on the tracker using its index. tracker.set(GAIFields.customDimension(for: 1), value:GA_ID) ``` **Objective-C** ```objectivec // Set the custom dimension value on the tracker using its index. [tracker set:[GAIFields customDimensionForIndex:1]  value:GA_ID]; ``` If you have a user id you send to Xtremepush, you can set that as a custom dimension as well if you don't do this already. **Swift** ```swift tracker.set(GAIFields.customDimension(for: 2), value:YOUR_User_ID) ``` **Objective-C** ```objectivec [tracker set:[GAIFields customDimensionForIndex:2]  value:YOUR_User_ID]; ``` Your user ID should also be set as the user ID on the GA tracker. **Swift** ```swift tracker?.set(kGAIUserId, value:YOUR_User_ID) ``` **Objective-C** ```objectivec [tracker set:kGAIUserId value: YOUR_User_ID]; ``` Finally, after completing the above settings, a `ScreenView` can be sent **Swift** ```swift tracker.send(GAIDictionaryBuilder.createScreenView().build() as! [AnyHashable : Any]!) ``` **Objective-C** ```objectivec [tracker send:[[GAIDictionaryBuilder createScreenView] build]]; ``` > [!TIP] > IDs should be sent with *every* hit ### Android To enable the Google Analytics targeting feature call the following method with the Google Analytics ID as the second param where this is available. ```java // Android enable google analytics targeting mPushConnector.hitTag("user.ga_id", GA_ID); ``` The Google Analytics ID can be retrieved using the following method from the GA SDK. ```java tracker.get("&cid"); ``` The GA_ID and the YOUR_User_ID should also be set as custom dimensions on the GA tracker. For example a `ScreenView` can be sent as follows: ```java // Send the custom dimension with a screen view.       tracker.send(new HitBuilders.ScreenViewBuilder()           .setCustomDimension(1, GA_ID )           .setCustomDimension(2, YOUR_User_ID )           .build()       ); ``` > [!TIP] > IDs should be sent with *every* hit