Event Based Rule for Download links

Avatar

Avatar

andrey_osadchu1

Avatar

andrey_osadchu1

andrey_osadchu1

26-01-2016

Hi everyone,

Can you please help me figure out how to make DTM intercepting clicks on download links.

The link looks as shown below:
<a href="https://forums.adobe.com/dir/filename.zip"><img src="/dir/button.png" /></a>

It seems the default Download Link Event Based Rule does not work in this case. The DTM debugger indicates only the following sequence of events when a click happens:

  • SATELLITE: detected click on IMG
  • SATELLITE: detected leave on #document

The overall goal is to pass the href value into a custom JS function.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

andrey_osadchu1

Avatar

andrey_osadchu1

andrey_osadchu1

02-02-2016

Thank you Parit for the additional input!

I was able to set up what intended after unchecking the Track Download links box in Adobe Analytics configuration dialog.

Thank you very much for your support!

Answers (3)

Answers (3)

Avatar

Avatar

ParitMittal

Avatar

ParitMittal

ParitMittal

01-02-2016

Hi Andrey, 

As per our  understanding there are 2 parts of your question ,1st being why the Event Based Rule you created for download link is not firing and the 2nd  being How to basically create an event based data element such that the data element captures the processed href value of the download link and then can be further used in tracking codes.

Answer to 1st part of your question: 

Generally if an event based rule doesn't fire on a click , there is likely an issue with the selector or condition of the rule. Locate the element on your site where the desired event action occurs, right click and select Inspect element. Inspect the highlighted script in the box that opens and ensure you are targeting the correct element. Please let us know if you have any questions on this .

Answer to 2nd part of your question: 

To define a data element on the fly and then use it in the interface for an event based rule,  we can dynamically capture the value of the event, and can set it  when defining the criteria for an event based rule, within the custom code block  in rule conditions using below code:  

var str= $(this).attr("href"); // This line will fetch the href of the download link clicked when an event click rule is fired on clicking of a link on the page. var str1= download file name   // Use some standard javascript functionality to get the file name from the str variable and assign it to str1 variable. _satellite.setVar('Download_Link_Name',str1); _satellite.getVar('Download_Link_Name'); return true;

//  This data element will now be available like any other within the interface using %Download_Link_Name%
Additional Points: 

  • setVar saves the data element on a page level scope – this is okay since you’ll typically only be manually setting these variables when you are referencing elements with $(this).
  • You can also use %% substitutions for these data elements within the UI. For the example above, we could have referenced the data element via %link ID%.
  • When you manually override a data element that exists and has a scope, it retains the scope of the element.

Please feel free to reach out to us in case of further queries.

Thanks & Regards

Parit Mittal 

Avatar

Avatar

andrey_osadchu1

Avatar

andrey_osadchu1

andrey_osadchu1

27-01-2016

Dear Parit,

Yes, that box is checked and the file extension is in the list. The download link tracking is working. My question was about how to intercept clicks on download links by DTM Event Based Rule for extra manipulation. I cannot understand why the rule as shown in the attached screenshots is not intercepting clicks on the links I mentioned in the first message. As a result Adobe Analytics request contains the default values as shown below:

    pe:lnk_d
    pev1:http://mydomain.com/dir/filename.zip

I was wondering if you could help me with an explanation of how to build an event based rule where I can add an extra JS code for href value processing? E.g. instead of capturing full URL in the default Download link report in Adobe Analytics, I would like to capture the file name only and to introduce a Data Element with it so that the file name can be passed to all other tracking codes added in DTM.

Avatar

Avatar

ParitMittal

Avatar

ParitMittal

ParitMittal

26-01-2016

Hi Andrey, 

Can you please recheck  "Link Tracking Tab" under Adobe Analytics Tool configuration and let us know whether the track download links checkbox is "checked" or not. As it is required to check the "track download links" option to enable the tracking of download links . Also , it is required to add the file download extension (e.g. .zip , .pdf etc) to Download Extensions . Please see the attached snapshot for more details.  

If the problem still persists , you can alternatively  create an event based rule for tracking the download link . Please see the following for more more information on creating event based rule.

https://marketing.adobe.com/resources/help/en_US/dtm/rules_event.html

Thanks & Regards

Parit Mittal