Integrating Referral AI Analytics with Google Analytics and Tag Manager can significantly enhance your understanding of user behavior and referral sources. Proper setup ensures accurate data collection, enabling better decision-making for your marketing strategies.

Prerequisites for Integration

  • Google Analytics account with property set up
  • Google Tag Manager container installed on your website
  • Referral AI Analytics account and API credentials
  • Basic knowledge of JavaScript and GTM interface

Step 1: Setting Up Referral AI Analytics

Obtain your Referral AI API key and endpoint URL from your dashboard. Configure your Referral AI dashboard to track the desired referral sources and events. Ensure that the data you want to analyze is being captured correctly within Referral AI.

Step 2: Creating Custom Tags in Google Tag Manager

Navigate to your GTM workspace and create a new tag to send Referral AI data to Google Analytics. Choose "Custom HTML" as the tag type. Insert the following script template:

Example Script:

<script>/* Replace with your Referral AI API call or data layer push */</script>

Configuring the Tag

Set the trigger to fire on all pages or specific pages where referral data is relevant. Save the tag.

Step 3: Sending Referral Data to Google Analytics

Create another GTM tag for Google Analytics Event tracking. Use the "Google Analytics: GA4 Event" tag type. Configure it with your GA4 Measurement ID and set event parameters to include referral information from Referral AI.

Example event parameters:

  • event_name: referral_click
  • referrer: {{ReferralReferrer}}
  • campaign: {{ReferralCampaign}}

Creating Variables

Define user-defined variables in GTM to capture referral data from the data layer or URL parameters. Use these variables in your event tags.

Step 4: Testing and Validation

Use GTM's Preview mode to test your tags and variables. Verify that referral data is correctly sent to Google Analytics. Check real-time reports to ensure data accuracy.

Best Practices and Tips

  • Use descriptive trigger names for clarity.
  • Leverage data layer pushes for structured data transfer.
  • Regularly audit your tags and data for accuracy.
  • Document your setup for future reference and troubleshooting.

Conclusion

Integrating Referral AI Analytics with Google Analytics and Tag Manager requires careful setup but offers valuable insights into your referral sources and user behavior. Following these technical tips will help you create a robust tracking system that supports your marketing analysis and decision-making processes.