How to Integrate Google Analytics 4 with Search Magic
Step 1: Grant Permission to Your Analytics Property
Log into your Google Analytics account by clicking here then click on Admin:
Click on Property Access Management:
Add a new user and assign it Viewer access to the email address [email protected].
Click Add when done.
Step 2: Create an Audience
You will need to create two new Audiences within Google Analytics.
To do so, navigate to the Admin page and click on Audiences:
Click on New Audience:
Click on Create a Custom Audience:
The first Audience needs to be called Site Search Users.
You’ll need to add the Event view_search_results within Include Users.
The second audience will need to be called Non-Site Search Users.
Delete the Include Users rule that Google Analytics automatically sets up.
Add Exclude users when the Event is view_search_results:
Step 3: Getting the Google Analytics Property ID
Next, you'll have to fill in the Google Property Id in Search Magic.
Go to Property Settings in the Admin section of the property:
You can copy the Property ID from this screen:
Now, go to your Search Magic dashboard, click on Store Settings and paste the Property ID in the Google View ID field:
Step 4: Enable Google Analytics Site Search Tracking
The final step is to enable Google Analytics Site Search Tracking.
In Google Analytics, click Admin, then Property, and select Data Streams.
Click on your store's Data Stream.
Scroll down to the Events sections and click on the settings icon under Enhanced measurement:
Please make sure Site Search is set to On and set the Search Term Query Parameter is set to query. If there already is a value in the field simply add a comma and then query - example: term,q,query.
GA4 is now set up for Search Magic!