Skip to main content
All CollectionsIntegrationsCMS IntegrationsGoogle Tag Manager
Use Google Tag Manager Variables as Custom Properties
Use Google Tag Manager Variables as Custom Properties
Updated over 2 months ago

If you haven't set up Google Tag Manager variables or if you need help with implementing them on Wisepops, we recommend reaching out to Braidr a marketing technology agency specializing in marketing data.

If you have already created custom variables in Google Tag Manager, you can use them in Wisepops.

To do so, add the following code after your Wisepops setup code:

// Send custom properties
wisepops('properties', {
VariableNameForWisepops: {{VariableNameOfGTM}}
}, {temporary: true});

{{VariableNameOfGTM}} must be replaced by your GTM variable name.

Here is a quick example. Let's say you want to exclude your newsletter subscribers from seeing your popup. Your GTM variable is called Subscribed. You want to use it with the name "subscribed" in Wisepops. Here's the code we would add:

// Send custom properties 
wisepops('properties', {
subscribed: {{subscribed}}
}, {temporary: true});

Ensure that the Wisepops trigger is not "Page view", but "DOM Ready". This is what your setup code would look like in Google Tag Manager.

You can then use that new variable in your custom conditions to make sure your campaign is displayed to the users who have not signed up yet.

If you want to use more properties, separate them with commas. For example:

// Send custom properties 
wisepops('properties', {
subscribed: {{subscribed}},
country: {{country}},
age: {{age}}
}, {temporary: true});

Troubleshooting

If the custom properties are not working as you expect, here is how you can verify the availability of the GTM variables for Wisepops.

1. Enable the GTM Preview mode:

2. Go to your website, on the page where you expect the GTM variables to be set as Wisepops custom properties.

3. Verify that the tag intended to set the custom properties is in the list of fired tags.

If not, you need to adjust the tag trigger.

4. Click on the tag.

Note the message where our tag is fired. In this example, the message is "3 DOM Ready".

Also note the GTM variable name that you want to verify. For this example we will focus on wordpressPageType (see the red arrow in the above example).

5. Click on the appropriate message in the left column, then open the Variables tab, and find your GTM variable in the list.

This shows you the value of your variable at the time when it was transmitted to Wisepops. If it is undefined, it is likely that your variable is set too late. You can find when it was made available by selecting Messages in the left column. To fix this, you must ensure that your variable has been defined before firing the tag that sets the Wisepops custom properties.

Did this answer your question?