Creating Pop-ups via Google Tag Manager or WordPress

You can simplify the process of creating popups in eSputnik using Google Tag Manager or WordPress. See the instructions for using these systems below.

Placing a Popup via GTM

Add the eSputnik script to your site using GTM. For this:

  1. In your eSputnik account, go to Site → Widgets. Get the script and copy it.
Widgets page in Yespo with the Get script button highlighted in the Install the script on the site banner
  1. Click the New button in the Tags section of your GTM account.
Tag Manager Tags page with the Tags menu item and New button highlighted, showing no existing tags
  1. Name the tag and click on the Tag Configuration field.
New tag window with the tag name field and Tag Configuration section both highlighted
  1. Select the tag type Custom HTML.
Choose tag type panel with the Custom HTML option highlighted
  1. Paste the script obtained in eSputnik into the HTML field. Save changes.
Tag Configuration window with Custom HTML tag type and the HTML field highlighted, containing the pasted eSputnik script
  1. A dialog box will appear. Click Add Trigger. You can also click Activate in the tag settings window.
No Triggers Selected dialog with the Add Trigger link highlighted next to Save Tag
  1. Select the type of trigger, for example — All Pages, to place a popup on all site pages.
Choose a trigger panel listing trigger options with All Pages highlighted

The tag and activator you created are ready to publish.

Installing on HubSpot Web and Landing Pages

After creating and activating the GTM tag above, connect GTM to your HubSpot pages: in HubSpot, click the settings icon, go to Website → Pages → Integrations, enable Integrate with Google Tag Manager, and enter your GTM container ID. The popup will then load on your HubSpot web and landing pages through GTM.

Installing on Wix Websites

After creating and activating the GTM tag above, connect GTM to your Wix site: in your Wix account, go to Settings → Marketing Integrations, find the Google Tag Manager tile and click Connect, select Add Google Tag Manager, then enter your GTM container ID and save.

Placing a Popup via WordPress

Use one of the three ways to add a script to a WordPress site (getting the script is described in the first step of the instructions for placing a popup window with GTM).

1. Using Insert Headers and Footers Plugin

This plugin allows you to install the eSputnik script on the entire WordPress site. For this:

  1. Follow the link and download the plugin.
  2. Activate the downloaded file and install the plugin according to the instructions.
  3. To activate the plugin, go to Insert Headers and Footers → Settings and insert the eSputnik script in one of the fields:
  • Script in Header (recommended)
  • Script in Footer
Insert Headers and Footers settings page with the Scripts in Header and Scripts in Footer fields highlighted, and the Insert Headers and Footers menu item highlighted
  1. Click Save.

The plugin will automatically upload the code to each page of your site.

2. Add the Script via Code Manually

You can add the script to WordPress files yourself (see instructions).

The script can be placed in the following site locations:

  • Header
  • A certain post
  • A certain page
  • Footer

Add a script to the site header

Paste the script into the functions.php file in the plugin for the site, or use the plugin for code snippets.

An example:

function wpb_hook_javascript() {
   ?>
       <script>
         // insert your javascript code here
       </script>
   <?php
}
add_action('wp_head', 'wpb_hook_javascript');

Add a script to a specific post

To add a plugin to one of the posts on WordPress, insert conditional logic into the code.

An example:

function wpb_hook_javascript() {
 if (is_single ('5')) {
   ?>
       <script type="text/javascript">
         // insert your javascript code here
       </script>
   <?php
 }
}
add_action('wp_head', 'wpb_hook_javascript');

This code executes the script only if the post has the identifier 5. You must insert 5 as your post ID.

The post ID is the number after post =.

WordPress post editor address bar with the post ID number in the URL highlighted

Add a script to a specific page

To add a script to a WordPress page, add conditional logic to the code.

An example:

function wpb_hook_javascript() {
 if (is_page ('10')) {
   ?>
       <script type="text/javascript">
         // insert your javascript code here
       </script>
   <?php
 }
}
add_action('wp_head', 'wpb_hook_javascript');

This code executes the script only if the page has the ID 10.

Add a script to the site footer

Add the following code snippet to your website, so the script runs in the footer.

An example:

function wpb_hook_javascript_footer() {
 ?>
    <script>
         // insert your javascript code here
       </script>
   <?php
}
add_action('wp_footer', 'wpb_hook_javascript_footer');

This code is attached to wp_footer instead of wp_head.

3. Adding a Script Inside Posts or Pages Using a Plugin

Use the plugin to select a place to embed the script in the site content.

  1. Download the Code Embed plugin.
  2. Install and activate the plugin in the plugin menu in WordPress controls. See the instructions for details.
  3. In the WordPress Post Editor, click on the context menu icon (three vertical dots) in the upper right corner of the screen and select Options.
WordPress post editor context menu open with the Options item highlighted
  1. In the dialog box, check the Custom fields option in the Advanced panel's section.
Options panel with the Custom fields checkbox highlighted in the Advanced panels section and the Enable and Reload button
  1. Click Enter new In the Custom Fields window under the content editor.
Custom Fields panel with the Enter new link highlighted next to the Name dropdown
  1. Enter the name of the custom field, which should start with the prefix CODE, and insert the script in the Value field.
  2. Click Add Custom Field.
Custom Fields panel with the Name field set to CODEmyjscode, the Value field containing a script, and the Add Custom Field button highlighted

Use this custom field to embed script code in any post or page position. To do this, add the following embed code anywhere on your content:

Embed code snippet showing the custom field placeholder syntax, CODEmyjscode in double curly braces

Then click Update or Publish to run the script code on the page or post.


Did this page help you?