GA Google Analytics Pro mostly operates behind the scenes with tracking codes added directly to your web pages, so there are no shortcodes necessary for any of the tracking features. But for the Opt-Out functionality, the plugin provides a collection of shortcodes that can be used to display an Opt-Out Box, static opt-out and opt-in links, and even a toggling opt-out/in link, all fully customizable for any configuration.
Opt-Out Shortcodes
GA Pro provides several shortcodes for displaying the Opt-Out Box and plain-text links.
Shortcode: Display Opt-Out Box
By default, GA Pro displays the Opt-Out Box on all of your WP-generated front-end web pages. If you would rather display the Opt-Out Box selectively, only on specific posts or pages, you can add the following shortcode:
[ga_pro_optout]
Note: To display opt-in and opt-out links inside of the Opt-Out Box, you can use these shortcodes (add via the “Opt-Out Message” setting).
- Opt-in link:
[ga_pro_optin_link]
- Opt-out link:
[ga_pro_optout_link]
You may use the following attributes with either of these shortcodes (opt-in link or opt-out link):
text
— Customize the link texttitle
— Customize the link title attribute
Note: the above shortcodes, [ga_pro_optin_link]
and [ga_pro_optout_link]
, work in the following plugin settings:
- Opt-Out Message (i.e., the Opt-Out Box)
- Opt-Out Success Message
- Opt-In Success Message
Shortcode: Display Opt-In Link
To display a plain-text link that enables the visitor to opt IN, add this shortcode to any WP Post or Page:
[gapro_optin_plain]
You may use the following attributes with this shortcode:
text
— Customize the link texttitle
— Customize the link title attributealert
— Customize the popup/alert message
Tip: you can add CSS/styles to this link via the class selector, .gapro-optin-plain
.
Shortcode: Display Opt-Out Link
To display a plain-text link that enables the visitor to opt OUT, add this shortcode to any WP Post or Page:
[gapro_optout_plain]
You may use the following attributes with this shortcode:
text
— Customize the link texttitle
— Customize the link title attributealert
— Customize the popup/alert message
Tip: you can add CSS/styles to this link via the class selector, .gapro-optout-plain
.
Note: the [gapro_optin_plain]
and [gapro_optout_plain]
shortcodes may be used multiple times on the same page.
Shortcode: Toggle Opt-Out Link
To display a plain-text link that toggles between opt-in and opt-out, add this shortcode to any WP Post or Page:
[gapro_optout_toggle]
This shortcode accepts six optional parameters. Three for the Opt-Out Link, and three for the Opt-In Link.
Opt-Out Link attributes:
text1
— Customize the link texttitle1
— Customize the link title attributealert1
— Customize the popup/alert message
Opt-In Link attributes:
text2
— Customize the link texttitle2
— Customize the link title attributealert2
— Customize the popup/alert message
So basically there are two ways to use this shortcode. First way is to not add any attributes. When the shortcode does not have any attributes, the link will toggle between the default Opt-In/Opt-Out (plain-text) Links. The second way is to include all six of the above attributes. This enables you to customize the text, title, and alert for each of the toggle links.
Example
Here is a quick copy/paste example of the custom toggle shortcode (using all available attributes):
[gapro_optout_toggle text1="Opt Out" text2="Opt In" title1="Opt Out" title2="Opt In" alert1="You Opted Out" alert2="You Opted In"]
Tip: you can add CSS/styles to the toggle link via the class selector, .gapro-optout-plain
.