Jump to content

Can you add Ad URL's track clickers to images?

Recommended Posts

Site URL: https://www.lngtv.com

Hello,

A client has provided me with a click tracker URL - https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https://www.exxonmobillng.com/About-us/Interactive-map?utm_source=LNGTV&utm_medium=display&utm_campaign=PE_Map&utm_content=New_PE_Map

 

And I need to add this to an image, but for some reason when I hyperlink it to the image using link via web address it doesn't seem to work and when you click the image it comes up with a white screen and doesn't re-direct you. I have tested the link on the site in word form and it works fine so it's only when using it on an image there is a problem. Any reason why? 

Link to comment
  • 2 weeks later...
  • Replies 19
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

On 7/14/2021 at 3:34 PM, Nipper said:

Hi. I don't see tracker url.

Also, /config is link for site owner. See how to find page url.

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

I tried to load a url as you show in your link editor image directly in the address bar of a browser window and it wouldn't load. The error was HTTP error 400 which means the sever doesn't understand the url. This indicates to me that the syntax of the URL may be bad.

https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=display

https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=displayhttps://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=displayhref="https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=display"

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
7 hours ago, creedon said:

I tried to load a url as you show in your link editor image directly in the address bar of a browser window and it wouldn't load. The error was HTTP error 400 which means the sever doesn't understand the url. This indicates to me that the syntax of the URL may be bad.

https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=display

https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=displayhttps://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=displayhref="https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=display"

But the link works perfectly for me outside of this, if I am copy and pasting the URL directly from the client email into my browser it works. Also, if I put the URL in as text on my site this also works, so I am not sure why on an image it doesn't? 

Link to comment
Quote

But the link works perfectly for me outside of this, if I am copy and pasting the URL directly from the client email into my browser it works.

Can you post the working URL you are pasting into the image block that corresponds to the non working URL above?

I'm thinking some processing is happening after you paste the working URL into the image block and it gets messed up.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment

This appears to be what you are entering for the image block url.

https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https://www.exxonmobillng.com/About-us/Interactive-map?utm_source=LNGTV&utm_medium=display&utm_campaign=PE_Map&utm_content=New_PE_Map

This is what SS is producing when the page is loaded.

https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=display

Obviously SS is encoding the url, which is screwing up the link and double click doesn't like it.

Other than reporting this as a bug to SS the only work around I can think of would be to use Javascript to decode the url and replace the bad url. That would require the business plan or above. Well technically you might be able to build your own image block in a code block but that would be a pain.

By the way I discovered the URLs you posted but to me they are hidden. I had to dig into the source of the forum page to see them.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
4 hours ago, creedon said:

This appears to be what you are entering for the image block url.

https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https://www.exxonmobillng.com/About-us/Interactive-map?utm_source=LNGTV&utm_medium=display&utm_campaign=PE_Map&utm_content=New_PE_Map

This is what SS is producing when the page is loaded.

https://ad.doubleclick.net/ddm/clk/491330615;298349270;l?https%3A%2F%2Fwww.exxonmobillng.com%2FAbout-us%2FInteractive-map%3Futm_source=LNGTV&utm_campaign=PE_Map&utm_content=New_PE_Map&utm_medium=display

Obviously SS is encoding the url, which is screwing up the link and double click doesn't like it.

Other than reporting this as a bug to SS the only work around I can think of would be to use Javascript to decode the url and replace the bad url. That would require the business plan or above. Well technically you might be able to build your own image block in a code block but that would be a pain.

By the way I discovered the URLs you posted but to me they are hidden. I had to dig into the source of the forum page to see them.

Okay thanks for clearing this up, makes total sense. Annoying on SS behalf but I guess we make do. We did actually get the client to send over some Javascript tags and they worked fine but the issue we had with that was SS wasn't resizing it for mobile so we couldn't use it.

 

Do you potentially have some code that would resize a javascript tag? Or does it need to be embedded within the tag itself 

 

Thanks for all your help so far! 

Link to comment

If you're game for using Javascript I suggest the fix I suggested.

Quote

the only work around I can think of would be to use Javascript to decode the url and replace the bad url.

I'm willing to give the code a go if you're up for it. It may take severals days for me to get to it. Bump this thread if I don't post soon.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment

Got to it sooner than expected! 🙂

Add the following to Settings > Advanced > Code Injection > HEADER.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

Add the following to Page Settings > Advanced > Page Header Code Injection for the page.

<script>

  /*
  
    begin fix image block SS encoded query component links
    
    Version         : 0.1d0
    
    SS Versions     : 7.0, 7.1
    
    Dependancies    : jQuery
    
    By              : Thomas Creedon < http://www.tomsWeb.consulting/ >
    
    */
    
    $( ( ) => {
    
      const urlPrefixMatches = [
      
        /*
        
          url prefix matches are used to restrict which urls will be fixed. not
          all urls need to be fixed
          
          following is an example line. copy the example line below and paste
          after the example line. remove '// ' at beginning of pasted line.
          repeat for as many url prefixes you want to match
          
          */
          
        // '[enter url prefix here between single quotes]',
        
        ];
        
      // do not change anything below, there be the borg here
      
      const getUriParser = uri => {
      
        const parser = document.createElement ( 'a' );
        
        parser.href = uri;
        
        return parser;
        
        };
        
      $( '.sqs-block-image-link' ).each ( function ( ) {
      
        const $this = $( this );
        
        let href = $this.attr ( 'href' );
        
        if ( urlPrefixMatches.length ) {
        
          const m = urlPrefixMatches.find ( s => href.startsWith ( s ) );
          
          if ( m === undefined ) return true;
          
          }
          
        const uriParser = getUriParser ( href );
        
        uriParser.search = decodeURIComponent ( uriParser.search );
        
        href = uriParser.toString ( );
        
        $this.attr ( 'href', href );
        
        } );
        
      // end fix image block SS encoded query component links
      
      } );
      
  </script>

After the example url prefix matches line add the following.

        'https://ad.doubleclick.net/',
        

Let us know how it goes.

Edited by creedon
added install jQuery step

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
12 hours ago, creedon said:

Got to it sooner than expected! 🙂

Add the following to Page Settings > Advanced > Page Header Code Injection for the page.

<script>

  /*
  
    begin fix image block SS encoded query component links
    
    Version         : 0.1d0
    
    SS Versions     : 7.0, 7.1
    
    Dependancies    : jQuery
    
    By              : Thomas Creedon < http://www.tomsWeb.consulting/ >
    
    */
    
    $( ( ) => {
    
      const urlPrefixMatches = [
      
        /*
        
          url prefix matches are used to restrict which urls will be fixed. not
          all urls need to be fixed
          
          following is an example line. copy the example line below and paste
          after the example line. remove '// ' at beginning of pasted line.
          repeat for as many url prefixes you want to match
          
          */
          
        // '[enter url prefix here between single quotes]',
        
        ];
        
      // do not change anything below, there be the borg here
      
      const getUriParser = uri => {
      
        const parser = document.createElement ( 'a' );
        
        parser.href = uri;
        
        return parser;
        
        };
        
      $( '.sqs-block-image-link' ).each ( function ( ) {
      
        const $this = $( this );
        
        let href = $this.attr ( 'href' );
        
        if ( urlPrefixMatches.length ) {
        
          const m = urlPrefixMatches.find ( s => href.startsWith ( s ) );
          
          if ( m === undefined ) return true;
          
          }
          
        const uriParser = getUriParser ( href );
        
        uriParser.search = decodeURIComponent ( uriParser.search );
        
        href = uriParser.toString ( );
        
        $this.attr ( 'href', href );
        
        } );
        
      // end fix image block SS encoded query component links
      
      } );
      
  </script>

After the example url prefix matches line add the following.

        'https://ad.doubleclick.net/',
        

Let us know how it goes.

Wow this is amazing! Thank you so much! Have I entered it in right? the URL still doesn't want to work 😕

Screenshot 2021-07-21 at 16.41.05.png

Link to comment

Replace the following line...

        /'['https://ad.doubleclick.net/',]',

...with...

        // '[enter url prefix here between single quotes]',
        
        'https://ad.doubleclick.net/',

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
10 minutes ago, creedon said:

Replace the following line...

        /'['https://ad.doubleclick.net/',]',

...with...

        // '[enter url prefix here between single quotes]',
        
        'https://ad.doubleclick.net/',

Let us know how it goes.

Still nothing unfortunately 

Screenshot 2021-07-21 at 17.54.44.png

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.