ExactMetrics' popular Google Analytics for WP (GADWP) plugin, which has over a million active installations, can still be used with Borlabs Cookie. In this article, you will learn how to obtain visitor consent before the tracking code is executed by GADWP.
Step 1: Add Script Blocker - Tracking Type Analytics
If you have selected the tracking type Analytics under Google Analytics > Tracking Code, follow the next steps.
From the Borlabs Cookie menu, click Script Blocker, then click Add New.
Define Page and Search Phrase
Next, you need to select a page to scan for JavaScript. Since GADWP is active on all pages, you can select any page here. In this case, we have chosen our Homepage.
To make the work easier, enter your tracking ID in the Search Phrases field. GADWP embeds JavaScript for Google Analytics via inline JavaScript. The tracking ID appears in the inline JavaScript, which does not appear anywhere else, making the inline JavaScript clearly identifiable for us.
Scanning
Once you have entered your Tracking ID in the Search Phrases field, click Scan. Borlabs Cookie will now scan your website for JavaScript and highlight the JavaScript in which the search phrases were found. When Borlabs Cookie has finished scanning, you will receive a message as shown in the image below and must click Next.
Configure
After your page has been scanned and you have clicked Next, you must set an ID and Name for your Script Blocker.
For ID enter gadwp and as name Google Analytics Dashboard for WP. You can set the Status to ON right away.
Choose JavaScript to Block
Scroll down a little to Matching JavaScript. Via our search phrases the correct inline JavaScript was found and set for blocking.
Click on Create Script Blocker to create the Script Blocker. After the saving was successful, you will get information about the blocked JavaScript handles (in this case none) and the set phrase that should block the JavaScript in which the phrase occurs.
Once a Script Blocker is created, you can no longer add or remove JavaScript handles and phrases. If you want to make a change, delete the Script Blocker and create it again.
Scroll down a little to Unblock code. The Script Blocker from Borlabs Cookie gives you two different unlock codes, one for Cookies and one for Content Blocker, which allows you to unblock the blocked JavaScript. Click on the clipboard icon to copy the JavaScript from For Cookies.
Step 1: Add Script Blocker - Tracking Type Tag Manager
If you have selected the Tag Manager tracking type under Google Analytics > Tracking Code, follow the next steps.
From the Borlabs Cookie menu, click Script Blocker, then click Add New.
Define Page and Search Phrase
Next, you need to select a page to scan for JavaScript. Since GADWP is active on all pages, you can select any page here. In this case, we have chosen our Homepage.
To make the work easier, enter your tracking ID in the Search Phrases field. GADWP embeds JavaScript for Google Analytics via inline JavaScript. The tracking ID appears in the inline JavaScript, which does not appear anywhere else, making the inline JavaScript clearly identifiable for us.
Scanning
Once you have entered your Tracking ID in the Search Phrases field, click Scan. Borlabs Cookie will now scan your website for JavaScript and highlight the JavaScript in which the search phrases were found. When Borlabs Cookie has finished scanning, you will receive a message as shown in the image below and must click Next.
Configure
After your page has been scanned and you have clicked Next, you must set an ID and Name for your Script Blocker.
For ID enter gadwp and as name Google Analytics Dashboard for WP. You can set the Status to ON right away.
Choose JavaScript to Block
Scroll down a little to Matching JavaScript. Via our search phrases, the correct inline JavaScript was found and set for blocking.
Click on Create Script Blocker to create the Script Blocker. After the saving was successful, you will get information about the blocked JavaScript handles (in this case none) and the set phrase that should block the JavaScript in which the phrase occurs.
Once a Script Blocker is created, you can no longer add or remove JavaScript handles and phrases. If you want to make a change, delete the Script Blocker and create it again.
Scroll down a little to Unblock code. The Script Blocker from Borlabs Cookie gives you two different unlock codes, one for Cookies and one for Content Blocker, which allows you to unblock the blocked JavaScript. Click on the clipboard icon to copy the JavaScript from For Cookies.
Schritt 2: Create Cookie
It's nearly done. Click on Cookies in Borlabs Cookie and then on Add New in the Cookie Group Statistics.
In Services, select Google Analytics and click Next.
Borlabs Cookie fills in all necessary data. Scroll down to Additional Settings and enter something in the Tracking ID field. This field is mandatory, but we don't need it.
Under Opt-in Code, insert the code (remove the existing code first) that you have just copied from the For Cookies field in the Script Blocker.
<script>window.BorlabsCookie.unblockScriptBlockerId("gadwp");</script>
After inserting the code, click on Save all settings
GADWP is now initially blocked and only if the visitor agrees to the Cookie for Google Analytics will GADWP be unblocked and tracking takes place.